<template>
  <div class="app-container">
    <el-tabs type="card" v-model="activeName">
      <el-tab-pane label="地图" name="first">
        <!--地图-->
        <EarthquakeSettingPointMap v-if="completeRefreshSettingPoint==true"
          @showPointSetDiv="showPointSetDiv" @showFaultSetDiv="showFaultSetDiv" @showGridSetDiv="showGridSetDiv" @mapLoading="mapLoading"
          @returnSetPage="returnSetPage"
          @getMap="getMap" @getSelectFeatureProperties="getSelectFeatureProperties" @showBaseDataLayerControl="showBaseDataLayerControl"
          @isLonLatInTaskRegionBool="isLonLatInTaskRegionBool"
          :dcAllData="dcAllData"
          :allSettingData="allSettingData"
          :deleteSettingTempBool="deleteSettingTempBool"
          :tempResultLonLatArray="tempResultLonLatArray"
          :taskRegion="taskRegion"
          :pageType="pageType"
          :faultSetDataId="faultSetDataId"
          :pointLonLat="pointLonLat"
          :selectRow="selectRow"
          :squareGrid="squareGrid"
          :pointGrid="pointGrid"
          :squareGridCenterLonLatList="squareGridCenterLonLatList"
          :showHideSetDivType="showHideSetDivType"
        ></EarthquakeSettingPointMap>
        <!--基础数据图层组件-->
        <BaseDataLayer v-if="completeRefreshSettingPoint==true"
           :map="map"
           :selectFeatureProperties="selectFeatureProperties"
           :showHideBaseDataLayerDivBool="showHideBaseDataLayerDivBool"
           :taskDistrict="taskDistrict"
        >
        </BaseDataLayer>
        <!--点状设定地震面板-->
        <div v-if="showHidePointSetDivBool" class="new-pointSetDiv">
          <div class="new-pointSetDiv-head">
            <span v-if="settingSeismicPoint.ssId==''" style="left:10px;">点状设定地震</span>
            <span v-else style="left:10px;">更新设定地震</span>
            <span style="right:10px;cursor:pointer;" @click="hidePointSetDiv">关闭</span>
          </div>
          <div class="new-pointSetDiv-inner">
            <el-form key="formPointKey" :model="settingSeismicPoint" ref="rulesFormPoint" label-position="right" label-width="110px">
             <!-- <el-form-item label="经纬度" prop="pointLonLat" style="margin-bottom: 15px;display:none;">
                <el-input v-model="pointLonLat"></el-input>
              </el-form-item>-->
              <el-form-item label="经纬度" prop="pointLonLat" style="margin-bottom: 15px;">
                <template v-if="uploadExcelLonLatArray.length==0">
                  <el-input type="number" v-model="pointLon" @change="setPointLonLat" style="width:90px;"
                            :precision="2" :step="0.01" step-strictly></el-input>
                  <span style="width:15px;padding:5px;">,</span>
                  <el-input type="number" v-model="pointLat" @change="setPointLonLat" style="width:90px;"
                            :precision="2" :step="0.01" step-strictly></el-input>
                </template>
                <!--批量Excel导入经纬度-->
                <el-button plain v-if="settingSeismicPoint.ssId==''" @click="handleImport">Excel批量导入经纬度</el-button>
              </el-form-item>
              <el-form-item label="震级" prop="isMagnitude" style="margin-bottom: 15px;">
                <el-radio-group v-model="settingSeismicPoint.isMagnitude" @change="zjRadioTypeSelectPoint" style="height: 27px;">
                  <el-radio label="1">自动生成</el-radio>
                  <el-radio label="2">自定义</el-radio>
                </el-radio-group>
              </el-form-item>
              <template v-if="settingSeismicPoint.isMagnitude=='1'">
                <div style="margin-left: 96px;">
                  <el-form-item label="基准震级" prop="benchmarkMagnitude" style="margin-bottom: 15px;" :rules="rulesPoint.benchmarkMagnitude">
                    <el-input type="number" v-model="settingSeismicPoint.benchmarkMagnitude" placeholder="请输入基准震级"
                              :precision="1" :step="0.1" step-strictly />
                  </el-form-item>
                  <el-form-item label="个数" prop="pointSeismicNumber" style="margin-bottom: 15px;" :rules="rulesPoint.pointSeismicNumber">
                    <el-select v-model="settingSeismicPoint.pointSeismicNumber" placeholder="请选择"
                               value-key="name" @change="zjNumChangePoint">
                      <el-option v-for="item in zjNumData" :key="item.name" :label="item.name" :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="上下增减间隔" prop="operationMagnitude" style="margin-bottom: 15px;"
                                :rules="settingSeismicPoint.pointSeismicNumber!='1' ? rulesPoint.operationMagnitude : [{ required: false}]">
                    <el-select v-model="settingSeismicPoint.operationMagnitude" placeholder="请选择" value-key="name"
                               :disabled="settingSeismicPoint.pointSeismicNumber=='1'">
                      <el-option v-for="item in zjIntervalData" :key="item.name" :label="item.name" :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </div>
              </template>
              <template v-else>
                <div style="margin-left: 96px;">
                  <!--自定义震级-->
                  <el-form-item v-for="(domain, index) in customPointDomains" label-width="92px" style="margin-bottom: 15px;"
                                :key="domain.key" label="输入震级" :prop="'customPointDomains.' + index + '.value'">
                    <el-input type="number" v-model="domain.value" @change="customPointDomainsChange" placeholder="请输入"
                              :precision="1" :step="0.1" step-strictly style="width: 88px;margin-right: 10px;" />
                    <el-button type="primary" :icon="Delete" circle @click.prevent="removeCustomPointDomains(domain)" />
                  </el-form-item>
                  <el-form-item label-width="92px">
                    <el-button plain @click="addCustomPointDomains">添加震级</el-button>
                  </el-form-item>
                </div>
              </template>
              <el-radio-group v-model="settingSeismicPoint.isAngle" @change="degreeTypeSelectPoint" style="height: 27px;">
                <el-form-item label="影响场角度" prop="isAngle" style="margin-bottom: 15px;">
                  <el-radio label="1">最近断层切线角度</el-radio>
                </el-form-item>
                <el-form-item label="" prop="angle" style="margin-top: -10px;margin-bottom: 15px;">
                  <el-radio label="2">指定角度
                    <el-input type="number" v-model="settingSeismicPoint.angle" placeholder="" :precision="0" :min="0" :max="180"
                              :disabled="settingSeismicPoint.isAngle=='1'" style="margin-left:14px;width:83px;" />
                    <span style="color:red"> [0-180]</span>
                  </el-radio>
                </el-form-item>
              </el-radio-group>
              <div style="margin-left: 96px;margin-top: 57px;">
                <!--<el-form-item label="步长" prop="stepSize" style="margin-top:50px;" :rules="rulesPoint.stepSize">-->
                <el-form-item label="步长" prop="stepSize" style="margin-top:50px;">
                  <el-select v-model="settingSeismicPoint.stepSize" placeholder="请选择" value-key="name" :clearable="true">
                    <el-option v-for="item in stepData" :key="item.name" :label="item.name" :value="item.name">
                    </el-option>
                  </el-select>
                </el-form-item>
              </div>
              <div style="margin-bottom: 5px;">
                <el-button @click="saveSettingPoint" type="primary" style="margin-left: 58px;">保存并设置下一个</el-button>
                <el-button plain @click="deleteSettingPoint" style="margin-left: 40px;">删除</el-button>
              </div>
            </el-form>
          </div>
        </div>
        <!-- Excel文件导入对话框 -->
        <el-dialog :title="upload.title" v-model="upload.open" width="400px" append-to-body>
          <p></p>
          <el-upload ref="uploadRef" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url"
                     :disabled="upload.isUploading" :before-upload="handleFileBeforeUpload"
                     :on-progress="handleFileUploadProgress" :on-error="handleFileUploadError"
                     :on-success="handleFileSuccess" :auto-upload="false" drag
                     :data="upload.uploadData">
            <el-icon class="el-icon--upload">
              <upload-filled />
            </el-icon>
            <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
            <template #tip>
              <div class="el-upload__tip text-center">
                <span>仅允许导入xls、xlsx格式文件。</span>
                <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate('点状设定地震经纬度数据模板.xlsx')">下载模板</el-link>
              </div>
            </template>
          </el-upload>
          <template #footer>
            <div class="dialog-footer">
              <el-button type="primary" @click="submitFileForm">确 定</el-button>
              <el-button plain @click="upload.open = false">取 消</el-button>
            </div>
          </template>
        </el-dialog>
        <!--断层设定地震面板-->
        <div v-if="showHideFaultSetDivBool" class="new-faultSetDiv">
          <div class="new-faultSetDiv-head">
            <span style="left:10px;">断层设定地震</span>
            <span style="right:10px;cursor:pointer;" @click="hideFaultSetDiv">关闭</span>
          </div>
          <div class="new-faultSetDiv-inner" style="padding-left: 10px;padding-bottom: 5px;">
            <el-form key="formFaultKey" :model="settingSeismicFault" ref="rulesFormFault" label-position="right" label-width="140px">
              <el-form-item label="与断层起始点距离" prop="distanceFault" style="margin-bottom: 15px;" :rules="rulesFault.distanceFault">
                <el-input type="number" v-model="settingSeismicFault.distanceFault" style="width: 100px;"
                          :precision="1" :step="0.1" step-strictly @change="clearTempResultLonLatArray" />
                <span style="margin-left: 10px;">公里</span>
              </el-form-item>
              <el-form-item label="震中位置：间隔" prop="intervalFault" style="margin-bottom: 15px;" :rules="rulesFault.intervalFault">
                <el-input type="number" v-model="settingSeismicFault.intervalFault" style="width: 60px;"
                          :precision="0" :step="1" step-strictly :min="1" :max="50" @change="clearTempResultLonLatArray" />
                <span style="margin-left: 10px;">公里</span>
                <el-link v-if="settingSeismicFault.sfId==null || settingSeismicFault.sfId==''"  type="primary"
                         @click="createSettingSeismicFault" :underline="false" style="position: absolute;left: 105px;">
                  生成震中位置
                </el-link>
                <el-link v-else @click="createSettingSeismicFault"  type="primary" :underline="false" style="position: absolute;left: 105px;">
                  重新生成震中位置
                </el-link>
              </el-form-item>
              <el-form-item label="震级" prop="isMagnitude" style="margin-bottom: 15px;">
                <el-radio-group v-model="settingSeismicFault.isMagnitude" @change="zjRadioTypeSelectFault" style="height: 27px;">
                  <el-radio label="1">自动生成</el-radio>
                  <el-radio label="2">自定义</el-radio>
                </el-radio-group>
              </el-form-item>
              <template v-if="settingSeismicFault.isMagnitude=='1'">
                <div style="margin-left: 96px;">
                  <el-form-item label="基准震级" prop="benchmarkMagnitude" style="margin-bottom: 15px;" :rules="rulesFault.benchmarkMagnitude">
                    <el-input type="number" v-model="settingSeismicFault.benchmarkMagnitude" placeholder="请输入基准震级"
                              :precision="1" :step="0.1" step-strictly />
                  </el-form-item>
                  <el-form-item label="个数" prop="settingSeismicNumber" style="margin-bottom: 15px;" :rules="rulesFault.settingSeismicNumber">
                    <el-select v-model="settingSeismicFault.settingSeismicNumber" placeholder="请选择"
                               value-key="name" @change="zjNumChangeFault">
                      <el-option v-for="item in zjNumData" :key="item.name" :label="item.name" :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="上下增减间隔" prop="operationMagnitude" style="margin-bottom: 15px;"
                                :rules="settingSeismicFault.settingSeismicNumber!='1' ? rulesFault.operationMagnitude : [{ required: false}]">
                    <el-select v-model="settingSeismicFault.operationMagnitude" placeholder="请选择" value-key="name"
                               :disabled="settingSeismicFault.settingSeismicNumber=='1'">
                      <el-option v-for="item in zjIntervalData" :key="item.name" :label="item.name" :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </div>
              </template>
              <template v-else>
                <div style="margin-left: 96px;">
                  <!--自定义震级-->
                  <el-form-item v-for="(domain, index) in customFaultDomains" label-width="92px" style="margin-bottom: 15px;"
                                :key="domain.key" label="输入震级" :prop="'customFaultDomains.' + index + '.value'">
                    <el-input type="number" v-model="domain.value" @change="customFaultDomainsChange" placeholder="请输入"
                              :precision="1" :step="0.1" step-strictly style="width: 88px;margin-right: 10px;" />
                    <el-button type="primary" :icon="Delete" circle @click.prevent="removeCustomFaultDomains(domain)" />
                  </el-form-item>
                  <el-form-item label-width="92px">
                    <el-button plain @click="addCustomFaultDomains">添加震级</el-button>
                  </el-form-item>
                </div>
              </template>
              <el-radio-group v-model="settingSeismicFault.isAngle" @change="degreeTypeSelectFault" style="height: 27px;">
                <el-form-item label="影响场角度" prop="isAngle" style="margin-bottom: 15px;">
                  <el-radio label="1">最近断层切线角度</el-radio>
                </el-form-item>
                <el-form-item label="" prop="angle" style="margin-top: -10px;margin-bottom: 15px;">
                  <el-radio label="2">指定角度
                    <el-input type="number" v-model="settingSeismicFault.angle" placeholder="" :precision="0" :min="0" :max="180"
                              :disabled="settingSeismicFault.isAngle=='1'" style="margin-left:14px;width:83px;" />
                    <span style="color:red"> [0-180]</span>
                  </el-radio>
                </el-form-item>
              </el-radio-group>
              <div style="margin-left: 96px;margin-top: 57px;">
                <!--<el-form-item label="步长" prop="stepSize" style="margin-top:50px;" :rules="rulesFault.stepSize">-->
                <el-form-item label="步长" prop="stepSize" style="margin-top:50px;">
                  <el-select v-model="settingSeismicFault.stepSize" placeholder="请选择" value-key="name" :clearable="true">
                    <el-option v-for="item in stepData" :key="item.name" :label="item.name" :value="item.name">
                    </el-option>
                  </el-select>
                </el-form-item>
              </div>
              <div style="margin-bottom: 5px;">
                <el-button v-if="settingSeismicFault.sfId!=null && settingSeismicFault.sfId!=''"
                            @click="updateSettingFault" type="primary" style="margin-left: 70px;">确定并覆盖原设置</el-button>
                <el-button v-else
                            @click="saveSettingFault" type="primary" style="margin-left: 158px;">确定</el-button>
                <el-button plain v-if="settingSeismicFault.sfId!=null && settingSeismicFault.sfId!=''"
                           @click="deleteSettingFault" style="margin-left: 40px;">删除</el-button>
              </div>
            </el-form>
          </div>
        </div>
        <!--公里格网设定地震面板-->
        <div v-if="showHideGridSetDivBool" class="new-gridSetDiv">
          <div class="new-gridSetDiv-head">
            <span style="left:10px;">公里格网设定地震</span>
            <span style="right:10px;cursor:pointer;" @click="hideGridSetDiv">关闭</span>
          </div>
          <div class="new-gridSetDiv-inner" style="padding-left: 10px;padding-bottom: 5px;">
            <el-form key="formGridKey" :model="settingSeismicGrid" ref="rulesFormGrid" label-position="right" label-width="160px">
              <el-form-item label="震中位置：格网大小" prop="gridsSize" style="margin-bottom: 15px;" :rules="rulesGrid.gridsSize">
                <el-input type="number" v-model="settingSeismicGrid.gridsSize" style="width: 60px;"
                          :precision="0" :step="1" step-strictly :min="1" :max="50" @change="clearTempResultLonLatArray" />
                <span style="margin-left: 10px;">公里</span>
                <el-link v-if="settingSeismicGrid.sfId==null || settingSeismicGrid.sfId==''" type="primary"
                         @click="createSettingSeismicGrid" :underline="false" style="position: absolute;left: 105px;">
                  生成震中位置
                </el-link>
                <el-link v-else @click="createSettingSeismicGrid" type="primary" :underline="false" style="position: absolute;left: 105px;">
                  重新生成震中位置
                </el-link>
              </el-form-item>
              <el-form-item label="震级" prop="isMagnitude" style="margin-bottom: 15px;">
                <el-radio-group v-model="settingSeismicGrid.isMagnitude" @change="zjRadioTypeSelectGrid" style="height: 27px;">
                  <el-radio label="1">自动生成</el-radio>
                  <el-radio label="2">自定义</el-radio>
                </el-radio-group>
              </el-form-item>
              <template v-if="settingSeismicGrid.isMagnitude=='1'">
                <div style="margin-left: 96px;">
                  <el-form-item label="基准震级" prop="benchmarkMagnitude" style="margin-bottom: 15px;" :rules="rulesGrid.benchmarkMagnitude">
                    <el-input type="number" v-model="settingSeismicGrid.benchmarkMagnitude" placeholder="请输入基准震级"
                              :precision="1" :step="0.1" step-strictly />
                  </el-form-item>
                  <el-form-item label="个数" prop="settingSeismicNumber" style="margin-bottom: 15px;" :rules="rulesGrid.settingSeismicNumber">
                    <el-select v-model="settingSeismicGrid.settingSeismicNumber" placeholder="请选择"
                               value-key="name" @change="zjNumChangeGrid">
                      <el-option v-for="item in zjNumData" :key="item.name" :label="item.name" :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="上下增减间隔" prop="operationMagnitude" style="margin-bottom: 15px;"
                                :rules="settingSeismicGrid.settingSeismicNumber!='1' ? rulesGrid.operationMagnitude : [{ required: false}]">
                    <el-select v-model="settingSeismicGrid.operationMagnitude" placeholder="请选择" value-key="name"
                               :disabled="settingSeismicGrid.settingSeismicNumber=='1'">
                      <el-option v-for="item in zjIntervalData" :key="item.name" :label="item.name" :value="item.name">
                      </el-option>
                    </el-select>
                  </el-form-item>
                </div>
              </template>
              <template v-else>
                <div style="margin-left: 96px;">
                  <!--自定义震级-->
                  <el-form-item v-for="(domain, index) in customGridDomains" label-width="92px" style="margin-bottom: 15px;"
                                :key="domain.key" label="输入震级" :prop="'customGridDomains.' + index + '.value'">
                    <el-input type="number" v-model="domain.value" @change="customGridDomainsChange" placeholder="请输入"
                              :precision="1" :step="0.1" step-strictly style="width: 88px;margin-right: 10px;" />
                    <el-button type="primary" :icon="Delete" circle @click.prevent="removeCustomGridDomains(domain)" />
                  </el-form-item>
                  <el-form-item label-width="92px">
                    <el-button plain @click="addCustomGridDomains">添加震级</el-button>
                  </el-form-item>
                </div>
              </template>
              <el-radio-group v-model="settingSeismicGrid.isAngle" @change="degreeTypeSelectGrid" style="height: 27px;">
                <el-form-item label="影响场角度" prop="isAngle" style="margin-bottom: 15px;">
                  <el-radio label="1">最近断层切线角度</el-radio>
                </el-form-item>
                <el-form-item label="" prop="angle" style="margin-top: -10px;margin-bottom: 15px;">
                  <el-radio label="2">指定角度
                    <el-input type="number" v-model="settingSeismicGrid.angle" placeholder="" :precision="0" :min="0" :max="180"
                              :disabled="settingSeismicGrid.isAngle=='1'" style="margin-left:14px;width:83px;" />
                    <span style="color:red"> [0-180]</span>
                  </el-radio>
                </el-form-item>
              </el-radio-group>
              <div style="margin-left: 96px;margin-top: 57px;">
                <!--<el-form-item label="步长" prop="stepSize" style="margin-top:50px;" :rules="rulesGrid.stepSize">-->
                <el-form-item label="步长" prop="stepSize" style="margin-top:50px;">
                  <el-select v-model="settingSeismicGrid.stepSize" placeholder="请选择" value-key="name" :clearable="true">
                    <el-option v-for="item in stepData" :key="item.name" :label="item.name" :value="item.name">
                    </el-option>
                  </el-select>
                </el-form-item>
              </div>
              <div style="margin-bottom: 5px;">
                <el-button v-if="settingSeismicGrid.sfId!=null && settingSeismicGrid.sfId!=''"
                            @click="updateSettingGrid" type="primary" style="margin-left: 70px;">确定并覆盖原设置</el-button>
                <el-button v-else
                            @click="saveSettingGrid" type="primary" style="margin-left: 158px;">确定</el-button>
                <el-button plain v-if="settingSeismicGrid.sfId!=null && settingSeismicGrid.sfId!=''"
                           @click="deleteSettingGrid" style="margin-left: 40px;">删除</el-button>
              </div>
            </el-form>
          </div>
        </div>
        <!--设定地震图例-->
        <div v-if="showHideEarthquakeLegendBool" class="new-setEarthquakeLegendDiv">
          <div style="text-align: center;">
            <span style="font-size: 14px;font-weight: bold;color: rgb(16, 124, 229);">图例</span>
          </div>
          <div>
            <div><div style="border-color:orange;" :style="{'background-color': 'rgba(255,255,255,0)'}" class="new-legendDiv-polygon"></div></div>
            <span>任务区域</span>
          </div>
          <div>
            <div><div style="border-color:black;" :style="{'background-color': 'red'}" class="new-legendDiv-polygon"></div></div>
            <span>设定地震</span>
          </div>
        </div>
        <!--下方查看详情面板-->
        <div v-if="detailTable" class="new-queryResultDiv">
          <div class="new-queryTableBtn">
            <el-button @click="closeDetailResultDiv" type="primary">关闭</el-button>
            <el-button plain v-if="allSettingData.length > 0" icon="Delete" @click="batchDelete">批量删除</el-button>
            <span class="new-queryTableSpan">设定地震</span>
          </div>
          <div class="new-queryTableDiv">
            <!--设定地震-->
            <el-table ref="multipleTable" :data="allSettingData" tooltip-effect="dark" height="150px"
                      :header-cell-style="{textAlign:'center'}" :cell-style="{textAlign:'center'}" @select="selectTableEvent" @selection-change="selectSetEQ">
              <el-table-column type="selection" align="center" width="50" />
             <!-- <el-table-column label="ssId" align="center" prop="ssId" />-->
              <el-table-column label="设定地震序号" align="center" prop="faultNum" />
              <el-table-column label="经度" align="center" prop="longitude" />
              <el-table-column label="纬度" align="center" prop="latitude" />
              <el-table-column label="宏观位置" align="center" prop="macroPosition" />
              <el-table-column label="每组条数" align="center" prop="count" />
              <el-table-column label="操作" align="center">
                <template #default="{ row }">
                  <el-link type="primary" :underline="false" @click="viewSetEQDetail(row)">查看明细</el-link>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <!-- 设定地震-生成地震明细弹框 -->
        <SetEQDetail v-model:open="setEQDetailOpen" :longitude="longitude" :latitude="latitude" :ssId="ssId"
                     @getSetEQCensus="getSetEQCensus"></SetEQDetail>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script setup name="earthquakeSettingPoint">
//地图
import EarthquakeSettingPointMap from '@/map/earthquakeLossesEstimation/earthquakeSetting/PointSet/map.vue';
import Polygon from 'ol/geom/Polygon';
import LineString from 'ol/geom/LineString';
//基础数据地图组件
import BaseDataLayer from '@/map/components/baseDataLayer/index.vue';
//地图空间分析
import { getPointDistanceByLineString,getLonLatByPointLine,getAngleByPointsLonLat,
  getPointsDistance,getPolygonContainsPointBoolean,
  createSquareGrid,createPointGrid,getDegreeByDistance} from "@/map/taskmanage/sceneexamine/mapUtil.js";
import { getAllFaultageData } from "@/api/basedatamanage/spaceData";
import { getAllSetting,getTaskInfoById,getFaultById,getAllCodeListByTaskId,
  saveSettingSeismicPoint,saveSettingSeismicPoint2,getSettingSeismicPointById,updateSettingSeismicPoint,deleteSettingSeismicPoint,
  saveSettingSeismicFault,deleteSettingSeismicFault,saveSettingSeismicGrid,deleteSettingSeismicGrid,
  queryProvinceCityCountyNameStringByLonLat,setEarthquakeCensus,setEarthquakeDelete,
  getIntersectionFaultByTaskId, isTaskRegionContainsLonLat,isTaskRegionTouchesLonLat,getLonLatsStringByTaskId,
  queryAllLonLatProvinceCityCountyNameStringByLonLatsString,getTaskRegionExtent,getSquareGridCenterLonLatList,
  getClosestFaultageAngleByLonLat,getClosestFaultageAngleListByLonLatsString
} from "@/api/earthquakeLossesEstimation/earthquakeSetting";
import { Delete } from '@element-plus/icons-vue';//图标
import SetEQDetail from '@/views/earthquakeLossesEstimation/earthquakeSetting/Dialog/setEQDetail.vue';
import { getToken } from "@/utils/auth";

const route = useRoute();
const router = useRouter();
const { proxy } = getCurrentInstance();
const activeName = ref("first");
const showHidePointSetDivBool = ref(false);//是否显示点状设定地震面板
const showHideFaultSetDivBool = ref(false);//是否显示断层设定地震面板
const showHideGridSetDivBool = ref(false);//是否显示公里格网设定地震面板
const showHideSetDivType = ref("");//是否显示1点状|2断层|3公里格网设定地震面板
const showHideEarthquakeLegendBool = ref(true);//是否显示设定地震图例
const taskUuid = ref("");//任务主键ID
const taskType = ref("");//任务信息类型
const pattern = ref("");//任务信息pattern
const returnPageName = ref("");//返回设定地震页面名称
//选中的图层要素的属性
const selectFeatureProperties = ref({});
//是否显示基础数据图层选择控件
const showHideBaseDataLayerDivBool = ref(false);

const detailTable = ref(false);//是否显示设定地震列表table
const selectRow = ref({});//选中的数据
// 设定地震
const setEQData = reactive({
  setEQDetailOpen: false,
  longitude: 0,
  latitude: 0,
  ssId:'',
})
const { setEQDetailOpen, longitude, latitude,ssId } = toRefs(setEQData);

const uploadExcelLonLatArray = ref([]);//点状设定地震Excel批量导入的经纬度列表
//////////////////////////////////////////////////////////////////////////////////上传文件功能start
/*** 用户导入参数 */
const upload = reactive({
  open: false,
  title: "",
  isUploading: false,
  headers: { token: "token" + getToken() },
  url: import.meta.env.VITE_APP_BASE_API + "/settingSeismic/importExcelPointLonLat",//Excel批量导入经纬度
  uploadData:{taskId:""},//上传带参数：任务ID
});

// 模板下载
function importTemplate(name) {
  proxy.download("/base/product/downloadExcel", {
    fileName:name
  }, name);
};

/** 提交上传文件 */
function submitFileForm() {
  proxy.$refs["uploadRef"].submit();
};

/** 打开导入表弹窗 */
function handleImport() {
  upload.title = "导入";
  upload.open = true;
  //清空上传Excel文件中的经纬度列表
  setUploadExcelLonLatArray(null);
}

/**文件上传前处理 */
function handleFileBeforeUpload(file) {
  proxy.$modal.loading("正在导入文件，请稍候...");
  return true
}

/**文件上传中处理 */
const handleFileUploadProgress = (event, file, fileList) => {
  upload.isUploading = true;
};
// 上传失败
function handleFileUploadError(err) {
  proxy.$modal.closeLoading();
  proxy.$modal.msgError("导入文件失败");
}
/** 文件上传成功处理 */
const handleFileSuccess = (response, file, fileList) => {
  upload.open = false;
  upload.isUploading = false;
  proxy.$modal.closeLoading();
  proxy.$refs["uploadRef"].handleRemove(file);
  proxy.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.message + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
  console.log("上传Excel文件返回解析结果");
  console.log(response);
  let message = response.message;
  let result = response.data;
  if(message.indexOf("导入成功")!=-1 && result.length>0){
    //test
    // let array = [[122.92,41.15],[122.93,41.17],[122.91,41.16],[122.9,41.14],[122.898,41.165]];
    let array = [];
    for(let i=0;i<result.length;i++){
      let data = result[i];
      array.push([data.lon,data.lat]);
    }
    //获取上传Excel文件中的经纬度列表
    setUploadExcelLonLatArray(array);
  }
};

//获取上传Excel文件中的经纬度列表
function setUploadExcelLonLatArray(array){
  pointLon.value = "";
  pointLat.value = "";
  pointLonLat.value = "";
  uploadExcelLonLatArray.value = [];
  if(array && array.length>0){
    uploadExcelLonLatArray.value = array;
    let lonlatString = "";
    for(let i=0;i<array.length;i++){
      let lonlat = array[i];
      if(lonlatString){
        lonlatString += ";";
      }
      lonlatString += lonlat[0] + "," + lonlat[1];
    }
    pointLonLat.value = lonlatString;
  }
}
//////////////////////////////////////////////////////////////////////////////////上传文件功能end

// 设定地震-查看明细弹框
const viewSetEQDetail = (row) => {
  setEQDetailOpen.value = true;
  longitude.value = row.longitude;
  latitude.value = row.latitude;
  ssId.value = row.ssId;//zyt
}

// 设定地震-设定地震列表
const getSetEQCensus = () => {
  //获取设定地震列表
  setEarthquakeCensus(taskUuid.value).then(res => {
    if (res.code == 200) {
      allSettingData.value = res.data;
    }
  })
}

//关闭查看详情面板
function closeDetailResultDiv(){
  detailTable.value = false;//关闭下方查看详情面板
}

//设定地震列表table勾选事件
function selectTableEvent(selection,row){
  selectRow.value = row;
}
//删除ID
const deleteIds = ref("");
// 设定地震-批量删除
const selectSetEQ = (selection) => {
  let ids = selection.map(item => {
    return item.faultNum;
  })
  deleteIds.value = ids.join(',');
}
const batchDelete = () => {
  deleteHandler(deleteIds.value);
}
// 设定地震-删除请求
const deleteHandler = ids => {
  if (!ids) {
    proxy.$modal.msgError('未选中任何删除数据！');
    return;
  }
  let taskId = taskUuid.value;
  proxy.$modal.confirm('是否确认删除？').then(() => {
    setEarthquakeDelete({ taskId:taskId, faultNum: ids }).then(res => {
      if (res.code == 200) {
        proxy.$modal.msgSuccess('删除成功！');
        getSetEQCensus();
      }
    })
  }).catch(err => { })
}

//设定地震经纬度修改事件
function setPointLonLat(){
  let lon = pointLon.value;
  let lat = pointLat.value;
  // //保留2位小数
  // pointLon.value = Number(lon).toFixed(2);
  // pointLat.value = Number(lat).toFixed(2);
  //保留5位小数
  pointLon.value = Number(lon).toFixed(5);
  pointLat.value = Number(lat).toFixed(5);
  pointLonLat.value = lon + "," + lat;
}

//1位小数校验(包括0.0)
const validateDistanceFault = (rule, value, callback) => {
  let bool = false;
  if(value>=0){
    let str = value.toString();
    let lastIndex = str.length - 1;
    let index = str.indexOf(".");
    if(index>0 && index<lastIndex && str.lastIndexOf(".")==index && index==(lastIndex-1)){//1位小数
      bool = true;
    }else if(index==-1){//整数
      bool = true;
    }
  }
  if (bool==false) {
    callback(new Error('请输入数字（1位小数）!'))
  } else {
    callback()
  }
}

//1位小数校验
const validateBenchmarkMagnitude = (rule, value, callback) => {
  let bool = false;
  if(value>0){
    let str = value.toString();
    let lastIndex = str.length - 1;
    let index = str.indexOf(".");
    if(index>0 && index<lastIndex && str.lastIndexOf(".")==index && index==(lastIndex-1)){//1位小数
      bool = true;
    }
  }
  if (bool==false) {
    callback(new Error('请输入数字（1位小数）!'))
  } else {
    callback()
  }
}

//角度0-180整数
const validateAngle = (rule, value, callback) => {
  if (value < 0 || value>180) {
    callback(new Error('请输入0-180的整数!'))
  } else {
    callback()
  }
}

//间隔1-50整数
const validateIntervalFault = (rule, value, callback) => {
  if (value < 1 || value>50) {
    callback(new Error('请输入1-50的整数!'))
  } else {
    callback()
  }
}

//间隔1-50整数
const validateGridSize = (rule, value, callback) => {
  if (value < 1 || value>50) {
    callback(new Error('请输入1-50的整数!'))
  } else {
    callback()
  }
}

//初始化数据
const data = reactive({
  queryParams: {//查询任务全部设定地震参数
    taskId:"",//任务主键ID
    type:"",//类型1点状2断层3公里格网,type为空则查询全部
  },
  layerDataQueryParams: {//断层数据查询参数
    province: "",
    city: "",
    county: "",
    dataType: "断层",//数据类型
  },
  settingSeismicPoint: {//点状设定地震参数
    earthquakeType:"1",//类型：1点状2断层3公里格网
    taskId:"",//任务ID
    ssId:"",//主键Id
    sfId:"",//外键Id
    coordinates: "",//经纬度坐标,省市县,角度
    //震级
    benchmarkMagnitude: "6.0",//基准震级
    pointSeismicNumber: "3",//个数
    operationMagnitude:"0.5",//上下增减间隔
    //自定义
    determineMagnitude:"",//确认震级,
    isMagnitude:"1",//1:基准震级；2:确认震级
    //影响场
    isAngle:"1",//影响场角度选项：1最近断层切线角度 2指定角度
    angle:"",//最近断层切线角度或指定角度（初始角度）
    stepSize:"",//步长
    createUserId:"",//创建人Id
    createUser:"",//创建人名称
    createTime:"",//创建时间
    updateUser:"",//修改人id
    updateTime:"",//修改时间
    isDelete:"",//删除标识：0未删除，1已删除
    //断层设定地震参数
    spaceRange: "",//空间范围
    distanceFault:"",//与断层起始点距离
    intervalFault:"",//按断层生成间隔(公里)
  },
  rulesPoint:{//校验点状设定地震
    benchmarkMagnitude: [{ required: true, message: "请输入基准震级", trigger: "blur" },{validator: validateBenchmarkMagnitude,trigger: 'blur'}],
    pointSeismicNumber: [{ required: true, message: "请选择个数", trigger: "change" }],
    operationMagnitude: [{ required: true, message: "请选择上下增减间隔", trigger: "change" }],
    angle: [{ required: true, message: "请输入指定角度[0-180]", trigger: "blur" }
      ,{pattern: /^[0-9]\d*$/,message: '请输入0-180的整数！',trigger: 'blur'}
      ,{validator: validateAngle,trigger: 'blur'}],
    //stepSize: [{ required: true, message: "请选择步长", trigger: "change" }],
  },
  settingSeismicFault: {//断层设定地震参数
    earthquakeType:"2",//类型：2断层3公里格网
    sfId:"",//主键Id
    taskId:"",//任务ID
    coordinates: "",//经纬度坐标,省市县,角度
    //震级-基准震级与确定震级必须选择一种填写
    benchmarkMagnitude: "6.0",//基准震级
    settingSeismicNumber: "3",//个数
    operationMagnitude:"0.5",//上下增减间隔
    //自定义
    settingSeismic:"",//确认震级,
    isMagnitude:"1",//1:基准震级；2:确认震级
    //影响场
    angle:"",//最近断层切线角度或指定角度（初始角度）
    isAngle:"1",//影响场角度选项：1最近断层切线角度 2指定角度
    stepSize:"",//步长
    createUserId:"",//创建人Id
    createUser:"",//创建人名称
    createTime:"",//创建时间
    updateUser:"",//修改人id
    updateTime:"",//修改时间
    isDelete:"",//删除标识：0未删除，1已删除
    //断层设定地震参数
    spaceRange: "",//空间范围
    distanceFault:"0.0",//与断层起始点距离
    intervalFault:"30",//按断层生成间隔(公里)
    //公里格网设定地震参数
    gridsSize:"",//格网大小（公里1-50）
  },
  rulesFault:{//校验断层设定地震
    distanceFault: [{ required: true, message: "请输入与断层起始点距离", trigger: "blur" },{validator: validateDistanceFault,trigger: 'blur'}],
    intervalFault: [{ required: true, message: "请输入间隔[1-50]", trigger: "blur" }
      ,{pattern: /^[0-9]\d*$/,message: '请输入1-50的整数！',trigger: 'blur'}
      ,{validator: validateIntervalFault,trigger: 'blur'}],
    benchmarkMagnitude: [{ required: true, message: "请输入基准震级", trigger: "blur" },{validator: validateBenchmarkMagnitude,trigger: 'blur'}],
    settingSeismicNumber: [{ required: true, message: "请选择个数", trigger: "change" }],
    operationMagnitude: [{ required: true, message: "请选择上下增减间隔", trigger: "change" }],
    angle: [{ required: true, message: "请输入指定角度[0-180]", trigger: "blur" }
      ,{pattern: /^[0-9]\d*$/,message: '请输入0-180的整数！',trigger: 'blur'}
      ,{validator: validateAngle,trigger: 'blur'}],
    //stepSize: [{ required: true, message: "请选择步长", trigger: "change" }],
  },
  settingSeismicGrid: {//公里格网设定地震参数
    earthquakeType:"3",//类型：2断层3公里格网
    sfId:"",//主键Id
    taskId:"",//任务ID
    coordinates: "",//经纬度坐标,省市县,角度
    //震级-基准震级与确定震级必须选择一种填写
    benchmarkMagnitude: "6.0",//基准震级
    settingSeismicNumber: "3",//个数
    operationMagnitude:"0.5",//上下增减间隔
    //自定义
    settingSeismic:"",//确认震级,
    isMagnitude:"1",//1:基准震级；2:确认震级
    //影响场
    angle:"",//最近断层切线角度或指定角度（初始角度）
    isAngle:"1",//影响场角度选项：1最近断层切线角度 2指定角度
    stepSize:"",//步长
    createUserId:"",//创建人Id
    createUser:"",//创建人名称
    createTime:"",//创建时间
    updateUser:"",//修改人id
    updateTime:"",//修改时间
    isDelete:"",//删除标识：0未删除，1已删除
    //断层设定地震参数
    spaceRange: "",//空间范围
    distanceFault:"",//与断层起始点距离
    intervalFault:"",//按断层生成间隔(公里)
    //公里格网设定地震参数
    gridsSize:"30",//格网大小（公里1-50）
  },
  rulesGrid:{//校验公里格网设定地震
    gridsSize: [{ required: true, message: "请输入间隔[1-50]", trigger: "blur" }
      ,{pattern: /^[0-9]\d*$/,message: '请输入1-50的整数！',trigger: 'blur'}
      ,{validator: validateGridSize,trigger: 'blur'}],
    benchmarkMagnitude: [{ required: true, message: "请输入基准震级", trigger: "blur" },{validator: validateBenchmarkMagnitude,trigger: 'blur'}],
    settingSeismicNumber: [{ required: true, message: "请选择个数", trigger: "change" }],
    operationMagnitude: [{ required: true, message: "请选择上下增减间隔", trigger: "change" }],
    angle: [{ required: true, message: "请输入指定角度[0-180]", trigger: "blur" }
      ,{pattern: /^[0-9]\d*$/,message: '请输入0-180的整数！',trigger: 'blur'}
      ,{validator: validateAngle,trigger: 'blur'}],
    //stepSize: [{ required: true, message: "请选择步长", trigger: "change" }],
  },
});
let {
  queryParams,
  layerDataQueryParams,
  settingSeismicPoint,
  rulesPoint,
  settingSeismicFault,
  rulesFault,
  settingSeismicGrid,
  rulesGrid
} = toRefs(data);

const dcAllData = ref([]);//断层图层数据
const allSettingData = ref([]);//全部设定地震图层数据
const deleteSettingTempBool = ref(false);//是否删除点状设定地震
var nearDcDegree = "";//最近断层切线角度
var lonlatAddressDataStr = "";//经纬度点地址解析字符串：经度,纬度,省,市,县
const taskDistrict = ref("");//任务地区（省-市-区县、）
const taskRegion = ref("");//任务区域经纬度
const pointLonLat = ref("");//点状设定地震经纬度
const pageType = ref("");//页面类型：1点状2断层3公里格网
const faultSetData = ref(null);//断层设定地震数据
const faultSetDataId = ref("");//断层设定地震ID
const gridSetData = ref(null);//公里格网设定地震数据
const gridSetDataId = ref("");//公里格网设定地震ID
const lonlatInTaskRegionBool = ref(false);//经纬度是否在任务区域内
const pointLon = ref("");//设定地震经度
const pointLat = ref("");//设定地震纬度
const taskRegionExtent = ref([]);//任务区域范围最小矩形的经纬度值数组
const squareGrid = ref({});//根据经纬度范围和格网距离生成的正方形网格
const pointGrid = ref({});//根据经纬度范围和格网距离生成点网格
const squareGridCenterLonLatList = ref([]);//任务范围的正方形公里格网网格线和震中位置经纬度列表

const tempResultLonLatArray = ref([]);//临时断层设定地震、公里格网设定地震生成震中位置数组
const taskRegionCoordinateArray = ref([]);//任务区域经纬度数组
// const taskRegionDcDataArray = ref([]);//任务区域断层信息数组
const allAngleDataArray = ref([]);//全部角度数组
const allLonLatProvinceCityCountyNameString = ref("");//查询全部经纬度点地址字符串
const queryAllAngleDataArrayBool = ref(false);//是否完成查询全部角度数组
const queryAddressDataStrArrayBool = ref(false);//是否完成查询经纬度点地址解析数组

//个数
const zjNumData = ref([
  {code:"0",name:"1"},
  {code:"1",name:"3"},
  {code:"2",name:"5"},
  {code:"3",name:"7"},
  {code:"4",name:"9"},
]);

//上下增减间隔
const zjIntervalData = ref([
  {code:"0",name:"0.1"},
  {code:"1",name:"0.2"},
  {code:"2",name:"0.3"},
  {code:"3",name:"0.4"},
  {code:"4",name:"0.5"},
]);

//步长
const stepData = ref([
  {code:"0",name:"10"},
  {code:"1",name:"30"},
  {code:"2",name:"60"},
]);

//自定义震级--点状
const customPointDomains = ref([
  {key:"0",value:""},
]);

//自定义震级--断层
const customFaultDomains = ref([
  {key:"0",value:""},
]);

//自定义震级--公里格网
const customGridDomains = ref([
  {key:"0",value:""},
]);

//移除自定义震级--点状
const removeCustomPointDomains = (item) => {
  if(customPointDomains.value.length>1){
    let index = customPointDomains.value.indexOf(item)
    if (index !== -1) {
      customPointDomains.value.splice(index, 1)
    }
  }else{
    alertMsg("无法删除，请至少需要保留1个自定义震级.");
  }
}

//移除自定义震级--断层
const removeCustomFaultDomains = (item) => {
  if(customFaultDomains.value.length>1){
    let index = customFaultDomains.value.indexOf(item)
    if (index !== -1) {
      customFaultDomains.value.splice(index, 1)
    }
  }else{
    alertMsg("无法删除，请至少需要保留1个自定义震级.");
  }
}

//移除自定义震级--公里格网
const removeCustomGridDomains = (item) => {
  if(customGridDomains.value.length>1){
    let index = customGridDomains.value.indexOf(item)
    if (index !== -1) {
      customGridDomains.value.splice(index, 1)
    }
  }else{
    alertMsg("无法删除，请至少需要保留1个自定义震级.");
  }
}

//添加自定义震级--点状
const addCustomPointDomains = () => {
  customPointDomains.value.push({
    key: Date.now(),
    value: '',
  })
}

//添加自定义震级--断层
const addCustomFaultDomains = () => {
  customFaultDomains.value.push({
    key: Date.now(),
    value: '',
  })
}

//添加自定义震级--公里格网
const addCustomGridDomains = () => {
  customGridDomains.value.push({
    key: Date.now(),
    value: '',
  })
}

//自定义震级改变事件--点状
function customPointDomainsChange(){
  let str = "";
  let array = customPointDomains.value;
  let bool = false;
  for(let i=0;i<array.length;i++){
    let value = array[i].value;
    if(value>0){
      let str = value.toString();
      let lastIndex = str.length - 1;
      let index = str.indexOf(".");
      if(index>0 && index<lastIndex && str.lastIndexOf(".")==index && index==(lastIndex-1)){//1位小数
        bool = true;
      }else{
        bool = false;//不是1位小数
        break;
      }
    }
    if(str!=""){
      str += ",";
    }
    str += array[i].value;
  }
  if(bool==false){
    alertMsg("请输入数字（1位小数）!");
  }else{
    //确认震级
    settingSeismicPoint.value.determineMagnitude = str;
  }

  return bool;
}

//自定义震级改变事件--断层
function customFaultDomainsChange(){
  let str = "";
  let array = customFaultDomains.value;
  let bool = false;
  for(let i=0;i<array.length;i++){
    let value = array[i].value;
    if(value>0){
      let str = value.toString();
      let lastIndex = str.length - 1;
      let index = str.indexOf(".");
      if(index>0 && index<lastIndex && str.lastIndexOf(".")==index && index==(lastIndex-1)){//1位小数
        bool = true;
      }else{
        bool = false;//不是1位小数
        break;
      }
    }
    if(str!=""){
      str += ",";
    }
    str += array[i].value;
  }
  if(bool==false){
    alertMsg("请输入数字（1位小数）!");
  }else{
    //确认震级
    settingSeismicFault.value.settingSeismic = str;
  }

  return bool;
}

//自定义震级改变事件--公里格网
function customGridDomainsChange(){
  let str = "";
  let array = customGridDomains.value;
  let bool = false;
  for(let i=0;i<array.length;i++){
    let value = array[i].value;
    if(value>0){
      let str = value.toString();
      let lastIndex = str.length - 1;
      let index = str.indexOf(".");
      if(index>0 && index<lastIndex && str.lastIndexOf(".")==index && index==(lastIndex-1)){//1位小数
        bool = true;
      }else{
        bool = false;//不是1位小数
        break;
      }
    }
    if(str!=""){
      str += ",";
    }
    str += array[i].value;
  }
  if(bool==false){
    alertMsg("请输入数字（1位小数）!");
  }else{
    //确认震级
    settingSeismicGrid.value.settingSeismic = str;
  }

  return bool;
}

//地图传参--start
const completeRefreshSettingPoint = ref(false);//防止刷新后地图不显示
const showPointSetDiv = (array)=>{//显示|隐藏点状设定地震面板
  //隐藏详情面板
  detailTable.value = false;
  //隐藏点状设定地震面板
  showHidePointSetDivBool.value = false;
  //隐藏断层设定地震面板
  showHideFaultSetDivBool.value = false;
  //隐藏公里格网设定地震面板
  showHideGridSetDivBool.value = false;
  console.log("显示|隐藏点状设定地震面板");
  //proxy.resetForm("rulesFormPoint");//对该表单项进行重置，将其值重置为初始值
  deleteSettingTempBool.value = false;//初始化是否清空临时设定地震图层
  showHideEarthquakeLegendBool.value = false;//隐藏设定地震图例
  uploadExcelLonLatArray.value = [];//清空上传Excel文件中的经纬度列表
  if(array!=null){
    showHideSetDivType.value = "1";//是否显示1点状|2断层|3公里格网设定地震面板
    mapLoading("正在查询...");
    console.log("点状allSettingData.value");
    console.log(faultSetData.value);
    console.log(gridSetData.value);
    let lonlatStr = array[0];
    let id = array[1];
    if(id==null || id===""){//新建
      //新建点状设置参数（不清空之前的设定参数）--点状设定地震
      newResetSavePointParams();
      //经纬度
      pointLonLat.value = lonlatStr;
      if(lonlatStr.indexOf(",")!=-1){
        let lonlatArr = lonlatStr.split(",");
        if(lonlatArr && lonlatArr.length==2){
          pointLon.value = lonlatStr.split(",")[0];
          pointLat.value = lonlatStr.split(",")[1];
          settingSeismicPoint.value.coordinates = lonlatStr;
          //查询经纬度点地址
          queryLonLatAddress(lonlatStr,false);//查询最近断层切线角度
        }
      }
    }else{//更新
      //初始化设置参数--点状设定地震
      resetSavePointParams();
      //查询点状设定地震
      querySettingPointById(id);
    }
  }else{
    showHideEarthquakeLegendBool.value = true;//显示设定地震图例
    showHideSetDivType.value = "";//是否显示1点状|2断层|3公里格网设定地震面板
  }
}
const showFaultSetDiv = (bool)=>{//显示|隐藏断层设定地震面板
  //隐藏详情面板
  detailTable.value = false;
  //隐藏断层设定地震面板
  showHideFaultSetDivBool.value = false;
  //隐藏公里格网设定地震面板
  showHideGridSetDivBool.value = false;
  //隐藏点状设定地震面板
  showHidePointSetDivBool.value = false;
  console.log("显示|隐藏断层设定地震面板");
  deleteSettingTempBool.value = false;//初始化是否清空临时设定地震图层
  showHideEarthquakeLegendBool.value = false;//隐藏设定地震图例
  if(bool){
    showHideSetDivType.value = "2";//是否显示1点状|2断层|3公里格网设定地震面板
    if(faultSetData.value!=null && faultSetData.value.sfId!=null && faultSetData.value.sfId!="") {//有断层设定地震数据
      //查询断层设定地震
      console.log("查询断层设定地震");
      console.log(faultSetData.value);
      //初始化设置参数--断层设定地震已有数据
      setSaveFaultParams();
      //获取自定义设定地震值
      getCustomFaultDomains();
      //设置与断层起始点距离整数为1位小数
      setDistanceFaultNumberFloat();
      //设置基准震级整数为1位小数
      setMagnitudeNumberFloatFault();
      //显示断层设定地震面板
      showHideFaultSetDivBool.value = true;
    }else{//新建
      console.log("新建断层设定地震");
      //初始化设置参数--断层设定地震
      resetSaveFaultParams();
      //显示断层设定地震面板
      showHideFaultSetDivBool.value = true;
    }
  }else{
    showHideSetDivType.value = "";//是否显示1点状|2断层|3公里格网设定地震面板
    showHideEarthquakeLegendBool.value = true;//显示设定地震图例
  }
}
const showGridSetDiv = (bool)=>{//显示|隐藏公里格网设定地震面板
  //隐藏详情面板
  detailTable.value = false;
  //隐藏断层设定地震面板
  showHideFaultSetDivBool.value = false;
  //隐藏公里格网设定地震面板
  showHideGridSetDivBool.value = false;
  //隐藏点状设定地震面板
  showHidePointSetDivBool.value = false;
  console.log("显示|隐藏公里格网设定地震面板");
  deleteSettingTempBool.value = false;//初始化是否清空临时设定地震图层
  showHideEarthquakeLegendBool.value = false;//隐藏设定地震图例
  if(bool){
    showHideSetDivType.value = "3";//是否显示1点状|2断层|3公里格网设定地震面板
    if(gridSetData.value!=null && gridSetData.value.sfId!=null && gridSetData.value.sfId!="") {//有公里格网设定地震数据
      //查询公里格网设定地震
      console.log("查询公里格网设定地震");
      console.log(gridSetData.value);
      //初始化设置参数--公里格网设定地震已有数据
      setSaveGridParams();
      //获取自定义设定地震值
      getCustomGridDomains();
      //设置基准震级整数为1位小数
      setMagnitudeNumberFloatGrid();
      //显示公里格网设定地震面板
      showHideGridSetDivBool.value = true;
    }else{//新建
      console.log("新建公里格网设定地震");
      //初始化设置参数--公里格网设定地震
      resetSaveGridParams();
      //显示公里格网设定地震面板
      showHideGridSetDivBool.value = true;
    }
  }else{
    showHideSetDivType.value = "";//是否显示1点状|2断层|3公里格网设定地震面板
    showHideEarthquakeLegendBool.value = true;//显示设定地震图例
  }
}
const mapLoading = (msg)=>{//地图查询loading
  if(msg!=null){
    proxy.$modal.loading(msg);
  }else{
    proxy.$modal.closeLoading();
  }
}
const returnSetPage = (bool)=>{//返回设定地震
  //router.push({path: "/earthquakeLossesEstimation/earthquakeDetail"});
  let id = taskUuid.value;
  let type = taskType.value;
  let taskPattern = pattern.value;
  let pageName = returnPageName.value;
  router.push({ path: "/earthquakeLossesEstimation/earthquakeDetail", query: {taskId: id, taskType:type, pattern:taskPattern, metaTitle: pageName} })
}
//地图对象
const map = ref(null);
const getMap = (obj)=>{
  map.value = obj;
}
//选中的地图要素的属性
const getSelectFeatureProperties = (obj)=>{
  selectFeatureProperties.value = obj;
}
//选中的地图要素的属性
const showBaseDataLayerControl = (bool)=>{
  showHideBaseDataLayerDivBool.value = bool;
}
//经纬度是否在任务区域内
const isLonLatInTaskRegionBool = (bool)=>{
  lonlatInTaskRegionBool.value = bool;
}
//地图传参--end

//关闭点状设定地震面板
function hidePointSetDiv(){
  showHideSetDivType.value = "";//是否显示1点状|2断层|3公里格网设定地震面板
  showHidePointSetDivBool.value = false;
  deleteSettingTempBool.value = true;//是否清空临时设定地震图层
  //查询任务全部设定地震
  queryAllSetting();
}

//关闭断层设定地震面板
function hideFaultSetDiv(){
  showHideSetDivType.value = "";//是否显示1点状|2断层|3公里格网设定地震面板
  showHideFaultSetDivBool.value = false;
  deleteSettingTempBool.value = true;//是否清空临时设定地震图层
  //查询任务全部设定地震
  queryAllSetting();
}

//关闭公里格网设定地震面板
function hideGridSetDiv(){
  showHideSetDivType.value = "";//是否显示1点状|2断层|3公里格网设定地震面板
  showHideGridSetDivBool.value = false;
  deleteSettingTempBool.value = true;//是否清空临时设定地震图层
  //清空任务范围的正方形公里格网网格线和震中位置经纬度列表
  squareGridCenterLonLatList.value = [];
  //查询任务全部设定地震
  queryAllSetting();
}

//警告消息
function alertMsg(msg){
  proxy.$modal.msgWarning(msg);
}

//初始化设置参数--点状设定地震
function resetSavePointParams(){
  proxy.resetForm("rulesFormPoint");//对该表单项进行重置，将其值重置为初始值
  pointLonLat.value = "";//点状设定地震经纬度显示
  nearDcDegree = "";//最近断层切线角度
  //清空经纬度点地址解析字符串：经度,纬度,省,市,县
  lonlatAddressDataStr = "";
  //默认显示1个自定义设定地震值
  customPointDomains.value = [
    {key:"0",value:""},
  ];
  settingSeismicPoint.value.earthquakeType = "1";//类型：1点状2断层3公里格网
  settingSeismicPoint.value.taskId = taskUuid.value;//任务ID
  settingSeismicPoint.value.ssId = "";//主键Id
  settingSeismicPoint.value.sfId = "";//外键Id
  settingSeismicPoint.value.coordinates = "";//经纬度
  //震级
  settingSeismicPoint.value.isMagnitude = "1";//震级选项：1自动生成 2自定义
  settingSeismicPoint.value.benchmarkMagnitude = "6.0";//基准震级
  settingSeismicPoint.value.pointSeismicNumber = "3";//个数
  settingSeismicPoint.value.operationMagnitude = "0.5";//上下增减间隔
  settingSeismicPoint.value.determineMagnitude = "";//自定义确认震级,
  //影响场
  settingSeismicPoint.value.isAngle = "1";//影响场角度选项：1最近断层切线角度 2指定角度
  settingSeismicPoint.value.angle = "";//最近断层切线角度或指定角度
  settingSeismicPoint.value.stepSize = "";//步长
  settingSeismicPoint.value.createUserId = "";//创建人Id
  settingSeismicPoint.value.createUser = "";//创建人名称
  settingSeismicPoint.value.createTime = "";//创建时间
  settingSeismicPoint.value.updateUser = "";//修改人id
  settingSeismicPoint.value.updateTime = "";//修改时间
  settingSeismicPoint.value.isDelete = "";//删除标识：0未删除，1已删除
  //断层设定地震参数
  settingSeismicPoint.value.spaceRange = "";//空间范围
  settingSeismicPoint.value.distanceFault = "";//与断层起始点距离
  settingSeismicPoint.value.intervalFault = "";//按断层生成间隔(公里)
}

//新建点状设置参数（不清空之前的设定参数）--点状设定地震
function newResetSavePointParams(){
  // proxy.resetForm("rulesFormPoint");//对该表单项进行重置，将其值重置为初始值
  pointLonLat.value = "";//点状设定地震经纬度显示
  nearDcDegree = "";//最近断层切线角度
  //清空经纬度点地址解析字符串：经度,纬度,省,市,县
  lonlatAddressDataStr = "";
  /*//默认显示1个自定义设定地震值
  customPointDomains.value = [
    {key:"0",value:""},
  ];
  settingSeismicPoint.value.earthquakeType = "1";//类型：1点状2断层3公里格网
  settingSeismicPoint.value.taskId = taskUuid.value;//任务ID*/
  settingSeismicPoint.value.ssId = "";//主键Id
  settingSeismicPoint.value.sfId = "";//外键Id
  settingSeismicPoint.value.coordinates = "";//经纬度
  /* //震级
  settingSeismicPoint.value.isMagnitude = "1";//震级选项：1自动生成 2自定义
  settingSeismicPoint.value.benchmarkMagnitude = "6.0";//基准震级
  settingSeismicPoint.value.pointSeismicNumber = "3";//个数
  settingSeismicPoint.value.operationMagnitude = "0.5";//上下增减间隔
  settingSeismicPoint.value.determineMagnitude = "";//自定义确认震级,
  //影响场
  settingSeismicPoint.value.isAngle = "1";//影响场角度选项：1最近断层切线角度 2指定角度
  settingSeismicPoint.value.angle = "";//最近断层切线角度或指定角度
  settingSeismicPoint.value.stepSize = "";//步长*/
  settingSeismicPoint.value.createUserId = "";//创建人Id
  settingSeismicPoint.value.createUser = "";//创建人名称
  settingSeismicPoint.value.createTime = "";//创建时间
  settingSeismicPoint.value.updateUser = "";//修改人id
  settingSeismicPoint.value.updateTime = "";//修改时间
  settingSeismicPoint.value.isDelete = "";//删除标识：0未删除，1已删除
  //断层设定地震参数
  settingSeismicPoint.value.spaceRange = "";//空间范围
  settingSeismicPoint.value.distanceFault = "";//与断层起始点距离
  settingSeismicPoint.value.intervalFault = "";//按断层生成间隔(公里)
}

//初始化设置参数--断层设定地震
function resetSaveFaultParams(){
  proxy.resetForm("rulesFormFault");//对该表单项进行重置，将其值重置为初始值
  //临时断层设定地震、公里格网设定地震生成震中位置数组
  tempResultLonLatArray.value = [];
  //默认显示1个自定义设定地震值
  customFaultDomains.value = [
    {key:"0",value:""},
  ];
  settingSeismicFault.value.taskId = taskUuid.value;//任务ID
  settingSeismicFault.value.sfId = "";//主键Id
  settingSeismicFault.value.coordinates = "";//经纬度
  //震级
  settingSeismicFault.value.isMagnitude = "1";//震级选项：1自动生成 2自定义
  settingSeismicFault.value.benchmarkMagnitude = "6.0";//基准震级
  settingSeismicFault.value.settingSeismicNumber = "3";//个数
  settingSeismicFault.value.operationMagnitude = "0.5";//上下增减间隔
  settingSeismicFault.value.settingSeismic = "";//自定义确认震级,
  //影响场
  settingSeismicFault.value.isAngle = "1";//影响场角度选项：1最近断层切线角度 2指定角度
  settingSeismicFault.value.angle = "";//最近断层切线角度或指定角度
  settingSeismicFault.value.stepSize = "";//步长
  settingSeismicFault.value.createUserId = "";//创建人Id
  settingSeismicFault.value.createUser = "";//创建人名称
  settingSeismicFault.value.createTime = "";//创建时间
  settingSeismicFault.value.updateUser = "";//修改人id
  settingSeismicFault.value.updateTime = "";//修改时间
  settingSeismicFault.value.isDelete = "";//删除标识：0未删除，1已删除
  //断层设定地震参数
  settingSeismicFault.value.spaceRange = "";//空间范围
  settingSeismicFault.value.distanceFault = "0.0";//与断层起始点距离
  settingSeismicFault.value.intervalFault = "30";//按断层生成间隔(公里)
  //公里格网设定地震参数
  settingSeismicFault.value.gridsSize = "";//格网大小（公里）
}

//初始化设置参数--断层设定地震已有数据
function setSaveFaultParams(){
  proxy.resetForm("rulesFormFault");//对该表单项进行重置，将其值重置为初始值
  //临时断层设定地震、公里格网设定地震生成震中位置数组
  tempResultLonLatArray.value = [];
  //默认显示1个自定义设定地震值
  customFaultDomains.value = [
    {key:"0",value:""},
  ];
  //断层设定地震已有数据
  if(faultSetData.value!=null && faultSetData.value.sfId!=null && faultSetData.value.sfId!=""){
    console.log("断层设定地震已有数据");
    console.log(faultSetData.value);
    settingSeismicFault.value.taskId = faultSetData.value.taskId;//任务ID
    settingSeismicFault.value.sfId = faultSetData.value.sfId;//主键Id
    settingSeismicFault.value.coordinates = faultSetData.value.coordinates;//经纬度
    //震级
    settingSeismicFault.value.isMagnitude = faultSetData.value.isMagnitude;//震级选项：1自动生成 2自定义
    settingSeismicFault.value.benchmarkMagnitude = faultSetData.value.benchmarkMagnitude;//基准震级
    settingSeismicFault.value.settingSeismicNumber = faultSetData.value.settingSeismicNumber;//个数
    settingSeismicFault.value.operationMagnitude = faultSetData.value.operationMagnitude;//上下增减间隔
    settingSeismicFault.value.settingSeismic = faultSetData.value.settingSeismic;//自定义确认震级,
    //影响场
    settingSeismicFault.value.isAngle = faultSetData.value.isAngle;//影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicFault.value.isAngle=="1"){//最近断层切线角度
      settingSeismicFault.value.angle = "";
    }else if(settingSeismicFault.value.isAngle=="2"){//指定角度
      settingSeismicFault.value.angle = faultSetData.value.angle;
    }
    if(faultSetData.value.stepSize=="0"){
      settingSeismicFault.value.stepSize = "";//步长
    }else{
      settingSeismicFault.value.stepSize = faultSetData.value.stepSize;//步长
    }
    settingSeismicFault.value.createUserId = faultSetData.value.createUserId;//创建人Id
    settingSeismicFault.value.createUser = faultSetData.value.createUser;//创建人名称
    settingSeismicFault.value.createTime = faultSetData.value.createTime;//创建时间
    settingSeismicFault.value.updateUser = faultSetData.value.updateUser;//修改人id
    settingSeismicFault.value.updateTime = faultSetData.value.updateTime;//修改时间
    settingSeismicFault.value.isDelete = faultSetData.value.isDelete;//删除标识：0未删除，1已删除
    //断层设定地震参数
    //settingSeismicFault.value.spaceRange = faultSetData.value.spaceRange;//空间范围
    settingSeismicFault.value.spaceRange = "";//清空空间范围--防止数据量太大无法保存
    settingSeismicFault.value.distanceFault = faultSetData.value.distanceFault;//与断层起始点距离
    settingSeismicFault.value.intervalFault = faultSetData.value.intervalFault;//按断层生成间隔(公里)
    //公里格网设定地震参数
    settingSeismicFault.value.gridsSize = faultSetData.value.gridsSize;//格网大小（公里）
  }
}

//初始化设置参数--公里格网设定地震
function resetSaveGridParams(){
  proxy.resetForm("rulesFormGrid");//对该表单项进行重置，将其值重置为初始值
  //临时断层设定地震、公里格网设定地震生成震中位置数组
  tempResultLonLatArray.value = [];
  //默认显示1个自定义设定地震值
  customGridDomains.value = [
    {key:"0",value:""},
  ];
  settingSeismicGrid.value.taskId = taskUuid.value;//任务ID
  settingSeismicGrid.value.sfId = "";//主键Id
  settingSeismicGrid.value.coordinates = "";//经纬度
  //震级
  settingSeismicGrid.value.isMagnitude = "1";//震级选项：1自动生成 2自定义
  settingSeismicGrid.value.benchmarkMagnitude = "6.0";//基准震级
  settingSeismicGrid.value.settingSeismicNumber = "3";//个数
  settingSeismicGrid.value.operationMagnitude = "0.5";//上下增减间隔
  settingSeismicGrid.value.settingSeismic = "";//自定义确认震级,
  //影响场
  settingSeismicGrid.value.isAngle = "1";//影响场角度选项：1最近断层切线角度 2指定角度
  settingSeismicGrid.value.angle = "";//最近断层切线角度或指定角度
  settingSeismicGrid.value.stepSize = "";//步长
  settingSeismicGrid.value.createUserId = "";//创建人Id
  settingSeismicGrid.value.createUser = "";//创建人名称
  settingSeismicGrid.value.createTime = "";//创建时间
  settingSeismicGrid.value.updateUser = "";//修改人id
  settingSeismicGrid.value.updateTime = "";//修改时间
  settingSeismicGrid.value.isDelete = "";//删除标识：0未删除，1已删除
  //断层设定地震参数
  settingSeismicGrid.value.spaceRange = "";//空间范围
  settingSeismicGrid.value.distanceFault = "";//与断层起始点距离
  settingSeismicGrid.value.intervalFault = "";//按断层生成间隔(公里)
  //公里格网设定地震参数
  settingSeismicGrid.value.gridsSize = "30";//格网大小（公里）
}

//初始化设置参数--公里格网设定地震已有数据
function setSaveGridParams(){
  proxy.resetForm("rulesFormGrid");//对该表单项进行重置，将其值重置为初始值
  //临时断层设定地震、公里格网设定地震生成震中位置数组
  tempResultLonLatArray.value = [];
  //默认显示1个自定义设定地震值
  customGridDomains.value = [
    {key:"0",value:""},
  ];
  //公里格网设定地震已有数据
  if(gridSetData.value!=null && gridSetData.value.sfId!=null && gridSetData.value.sfId!=""){
    console.log("公里格网设定地震已有数据");
    console.log(gridSetData.value);
    settingSeismicGrid.value.taskId = gridSetData.value.taskId;//任务ID
    settingSeismicGrid.value.sfId = gridSetData.value.sfId;//主键Id
    settingSeismicGrid.value.coordinates = gridSetData.value.coordinates;//经纬度
    //震级
    settingSeismicGrid.value.isMagnitude = gridSetData.value.isMagnitude;//震级选项：1自动生成 2自定义
    settingSeismicGrid.value.benchmarkMagnitude = gridSetData.value.benchmarkMagnitude;//基准震级
    settingSeismicGrid.value.settingSeismicNumber = gridSetData.value.settingSeismicNumber;//个数
    settingSeismicGrid.value.operationMagnitude = gridSetData.value.operationMagnitude;//上下增减间隔
    settingSeismicGrid.value.settingSeismic = gridSetData.value.settingSeismic;//自定义确认震级,
    //影响场
    settingSeismicGrid.value.isAngle = gridSetData.value.isAngle;//影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicGrid.value.isAngle=="1"){//最近断层切线角度
      settingSeismicGrid.value.angle = "";
    }else if(settingSeismicGrid.value.isAngle=="2"){//指定角度
      settingSeismicGrid.value.angle = gridSetData.value.angle;
    }
    if(gridSetData.value.stepSize=="0"){
      settingSeismicGrid.value.stepSize = "";//步长
    }else{
      settingSeismicGrid.value.stepSize = gridSetData.value.stepSize;//步长
    }
    settingSeismicGrid.value.createUserId = gridSetData.value.createUserId;//创建人Id
    settingSeismicGrid.value.createUser = gridSetData.value.createUser;//创建人名称
    settingSeismicGrid.value.createTime = gridSetData.value.createTime;//创建时间
    settingSeismicGrid.value.updateUser = gridSetData.value.updateUser;//修改人id
    settingSeismicGrid.value.updateTime = gridSetData.value.updateTime;//修改时间
    settingSeismicGrid.value.isDelete = gridSetData.value.isDelete;//删除标识：0未删除，1已删除
    //断层设定地震参数
    //settingSeismicGrid.value.spaceRange = gridSetData.value.spaceRange;//空间范围
    settingSeismicGrid.value.spaceRange = "";//清空空间范围--防止数据量太大无法保存
    settingSeismicGrid.value.distanceFault = gridSetData.value.distanceFault;//与断层起始点距离
    settingSeismicGrid.value.intervalFault = gridSetData.value.intervalFault;//按断层生成间隔(公里)
    //公里格网设定地震参数
    settingSeismicGrid.value.gridsSize = gridSetData.value.gridsSize;//格网大小（公里）
  }
}

//震级选项切换事件--点状
function zjRadioTypeSelectPoint(){
  //震级选项：1自动生成 2自定义
  let type = settingSeismicPoint.value.isMagnitude;
  if(type=="1"){//1自动生成
    //默认值
    settingSeismicPoint.value.benchmarkMagnitude = "6.0";//基准震级
    settingSeismicPoint.value.pointSeismicNumber = "3";//个数
    settingSeismicPoint.value.operationMagnitude = "0.5";//上下增减间隔
  }else if(type=="2"){//2自定义
    //清空
    settingSeismicPoint.value.benchmarkMagnitude = "";//基准震级
    settingSeismicPoint.value.pointSeismicNumber = "";//个数
    settingSeismicPoint.value.operationMagnitude = "";//上下增减间隔
  }
}

//震级选项切换事件--断层
function zjRadioTypeSelectFault(){
  //震级选项：1自动生成 2自定义
  let type = settingSeismicFault.value.isMagnitude;
  if(type=="1"){//1自动生成
    //默认值
    settingSeismicFault.value.benchmarkMagnitude = "6.0";//基准震级
    settingSeismicFault.value.settingSeismicNumber = "3";//个数
    settingSeismicFault.value.operationMagnitude = "0.5";//上下增减间隔
  }else if(type=="2"){//2自定义
    //清空
    settingSeismicFault.value.benchmarkMagnitude = "";//基准震级
    settingSeismicFault.value.settingSeismicNumber = "";//个数
    settingSeismicFault.value.operationMagnitude = "";//上下增减间隔
  }
}

//震级选项切换事件--公里格网
function zjRadioTypeSelectGrid(){
  //震级选项：1自动生成 2自定义
  let type = settingSeismicGrid.value.isMagnitude;
  if(type=="1"){//1自动生成
    //默认值
    settingSeismicGrid.value.benchmarkMagnitude = "6.0";//基准震级
    settingSeismicGrid.value.settingSeismicNumber = "3";//个数
    settingSeismicGrid.value.operationMagnitude = "0.5";//上下增减间隔
  }else if(type=="2"){//2自定义
    //清空
    settingSeismicGrid.value.benchmarkMagnitude = "";//基准震级
    settingSeismicGrid.value.settingSeismicNumber = "";//个数
    settingSeismicGrid.value.operationMagnitude = "";//上下增减间隔
  }
}

//影响场角度选项切换事件--点状
function degreeTypeSelectPoint(){
  //影响场角度选项：1最近断层切线角度 2指定角度
  let type = settingSeismicPoint.value.isAngle;
  if(type=="1"){
    settingSeismicPoint.value.angle = nearDcDegree;//最近断层切线角度
  }else if(type=="2"){
    settingSeismicPoint.value.angle = "";
  }
}

//影响场角度选项切换事件--断层
function degreeTypeSelectFault(){
  settingSeismicFault.value.angle = "";
}

//影响场角度选项切换事件--公里格网
function degreeTypeSelectGrid(){
  settingSeismicGrid.value.angle = "";
}

//个数选择事件--点状
function zjNumChangePoint(){
  //个数
  if(settingSeismicPoint.value.pointSeismicNumber=="1"){
    settingSeismicPoint.value.operationMagnitude = "";//清空上下增减间隔
  }else{
    if(settingSeismicPoint.value.operationMagnitude===""){
      settingSeismicPoint.value.operationMagnitude = "0.5";//上下增减间隔，默认0.5
    }
  }
}

//个数选择事件--断层
function zjNumChangeFault(){
  //个数
  if(settingSeismicFault.value.settingSeismicNumber==="1"){
    settingSeismicFault.value.operationMagnitude = "";//清空上下增减间隔
  }else{
    if(settingSeismicFault.value.operationMagnitude===""){
      settingSeismicFault.value.operationMagnitude = "0.5";//上下增减间隔，默认0.5
    }
  }
}

//个数选择事件--公里格网
function zjNumChangeGrid(){
  //个数
  if(settingSeismicGrid.value.settingSeismicNumber==="1"){
    settingSeismicGrid.value.operationMagnitude = "";//清空上下增减间隔
  }else{
    if(settingSeismicGrid.value.operationMagnitude===""){
      settingSeismicGrid.value.operationMagnitude = "0.5";//上下增减间隔，默认0.5
    }
  }
}

//查询任务全部设定地震
function queryAllSetting(){
  mapLoading("正在查询...");
  queryParams.value.type = "";
  //allSettingData.value = [];//清空
  console.log("查询任务全部设定地震queryParams.value.taskId");
  console.log(queryParams.value.taskId);
  getAllSetting(queryParams.value).then((response) => {
    nextTick(() => {
      console.log("查询任务全部设定地震");
      console.log(response.data);
      //全部设定地震图层数据
      allSettingData.value = response.data.detailsList;
      let dataList = response.data.detailsList;
      if(dataList!=null && dataList.length>0){
        detailTable.value = true;//显示设定地震列表table
      }else{
        detailTable.value = false;//隐藏设定地震列表table
      }
      //断层设定地震数据、公里格网设定地震数据
      let list = response.data.settingSeismicFault;
      if(list!=null && list.length>0){
        for(let i=0;i<list.length;i++){
          if(list[i].sfId!=null && list[i].sfId!=""){
            if(list[i].earthquakeType=="2"){
              //断层设定地震数据
              faultSetData.value = list[i];
              //断层设定地震ID
              faultSetDataId.value = list[i].sfId;
            }else if(list[i].earthquakeType=="3"){
              //公里格网设定地震数据
              gridSetData.value = list[i];
              //公里格网设定地震ID
              gridSetDataId.value = list[i].sfId;
            }
          }
        }
      }
      mapLoading(null);
    });
  });
}

//初始化查询任务全部设定地震
function initQueryAllSetting(){
  mapLoading("正在查询...");
  queryParams.value.type = "";
  allSettingData.value = [];//清空
  console.log("查询任务全部设定地震queryParams.value.taskId");
  console.log(queryParams.value.taskId);
  getAllSetting(queryParams.value).then((response) => {
    nextTick(() => {
      console.log("查询任务全部设定地震");
      console.log(response.data);
      //全部设定地震图层数据
      allSettingData.value = response.data.detailsList;
      if(pageType.value=="1") {//点状设定地震
        let dataList = response.data.detailsList;
        if(dataList!=null && dataList.length>0){
          detailTable.value = true;//显示设定地震列表table
        }else{
          detailTable.value = false;//隐藏设定地震列表table
        }
      }
      //断层设定地震数据、公里格网设定地震数据
      let list = response.data.settingSeismicFault;
      if(list!=null && list.length>0){
        for(let i=0;i<list.length;i++){
          if(list[i].sfId!=null && list[i].sfId!=""){
            if(list[i].earthquakeType=="2"){
              //断层设定地震数据
              faultSetData.value = list[i];
              //断层设定地震ID
              faultSetDataId.value = list[i].sfId;
            }else if(list[i].earthquakeType=="3"){
              //公里格网设定地震数据
              gridSetData.value = list[i];
              //公里格网设定地震ID
              gridSetDataId.value = list[i].sfId;
            }
          }
        }
      }
      if(pageType.value=="1") {//页面类型：1点状2断层3公里格网
        //初始化设置参数--点状设定地震
        resetSavePointParams();
      }else if(pageType.value=="2") {//页面类型：1点状2断层3公里格网
        showFaultSetDiv(true);//显示断层设定地震
      }else if(pageType.value=="3") {//页面类型：1点状2断层3公里格网
        showGridSetDiv(true);//显示公里格网设定地震
      }
      mapLoading(null);
    });
  });
}

//根据ID查询点状设定地震
function querySettingPointById(id){
  console.log("点状1allSettingData.value");
  console.log(faultSetData.value);
  console.log(gridSetData.value);
  if(id!=null){
    getSettingSeismicPointById(id).then((response) => {
      nextTick(() => {
        //查询点状设定地震
        console.log("查询点状设定地震"+id);
        console.log(response.data);
        settingSeismicPoint.value = response.data;
        if(settingSeismicPoint.value.isAngle=="1"){
          nearDcDegree = settingSeismicPoint.value.angle;//最近断层切线角度
        }
        if(settingSeismicPoint.value.stepSize=="0"){
          settingSeismicPoint.value.stepSize = "";//步长
        }
        settingSeismicPoint.value.spaceRange = "";//清空空间范围--防止数据量太大无法保存
        //经纬度
        let lonlatStr = settingSeismicPoint.value.coordinates;
        pointLonLat.value = lonlatStr;
        pointLon.value = lonlatStr.split(",")[0];
        pointLat.value = lonlatStr.split(",")[1];
        //查询经纬度点地址
        queryLonLatAddress(pointLonLat.value,false);
        //获取自定义设定地震值
        getCustomPointDomains();
        //设置基准震级整数为1位小数
        setMagnitudeNumberFloatPoint();
        console.log("点状2allSettingData.value");
        console.log(faultSetData.value);
        console.log(gridSetData.value);
      });
    });
  }
}

//获取自定义设定地震值--点状
function getCustomPointDomains(){
  //默认显示1个自定义设定地震值
  customPointDomains.value = [
    {key:"0",value:""},
  ];
  if(settingSeismicPoint.value.isMagnitude=="2") {//2自定义
    let str = settingSeismicPoint.value.determineMagnitude;
    if(str!=null && str!=""){
      let array = str.split(",");
      if(array!=null && array.length>0){
        customPointDomains.value = [];
        for(let i=0;i<array.length;i++){
          let value = array[i];
          customPointDomains.value.push({
            key: i,
            value: value,
          });
        }
      }
    }
  }
}

//获取自定义设定地震值--断层
function getCustomFaultDomains(){
  //默认显示1个自定义设定地震值
  customFaultDomains.value = [
    {key:"0",value:""},
  ];
  if(settingSeismicFault.value.isMagnitude=="2") {//2自定义
    let str = settingSeismicFault.value.settingSeismic;
    if(str!=null && str!=""){
      let array = str.split(",");
      if(array!=null && array.length>0){
        customFaultDomains.value = [];
        for(let i=0;i<array.length;i++){
          let value = array[i];
          customFaultDomains.value.push({
            key: i,
            value: value,
          });
        }
      }
    }
  }
}

//获取自定义设定地震值--公里格网
function getCustomGridDomains(){
  //默认显示1个自定义设定地震值
  customGridDomains.value = [
    {key:"0",value:""},
  ];
  if(settingSeismicGrid.value.isMagnitude=="2") {//2自定义
    let str = settingSeismicGrid.value.settingSeismic;
    if(str!=null && str!=""){
      let array = str.split(",");
      if(array!=null && array.length>0){
        customGridDomains.value = [];
        for(let i=0;i<array.length;i++){
          let value = array[i];
          customGridDomains.value.push({
            key: i,
            value: value,
          });
        }
      }
    }
  }
}

//设置与断层起始点距离整数为1位小数
function setDistanceFaultNumberFloat(){
  let str = settingSeismicFault.value.distanceFault;//与断层起始点距离
  if(str!=null && str!=""){
    str = str.toString();
    if(str.indexOf(".")==-1){
      str += ".0";
    }
    settingSeismicFault.value.distanceFault = str;//与断层起始点距离
    console.log("设置与断层起始点距离整数为1位小数:"+str);
  }
}

//设置基准震级整数为1位小数--点状
function setMagnitudeNumberFloatPoint(){
  let str = settingSeismicPoint.value.benchmarkMagnitude;//基准震级
  if(str!=null && str!=""){
    str = str.toString();
    if(str.indexOf(".")==-1){
      str += ".0";
    }
    settingSeismicPoint.value.benchmarkMagnitude = str;//基准震级
    console.log("设置基准震级整数为1位小数:"+str);
  }
}

//设置基准震级整数为1位小数--断层
function setMagnitudeNumberFloatFault(){
  let str = settingSeismicFault.value.benchmarkMagnitude;//基准震级
  if(str!=null && str!=""){
    str = str.toString();
    if(str.indexOf(".")==-1){
      str += ".0";
    }
    settingSeismicFault.value.benchmarkMagnitude = str;//基准震级
    console.log("设置基准震级整数为1位小数:"+str);
  }
}

//设置基准震级整数为1位小数--公里格网
function setMagnitudeNumberFloatGrid(){
  let str = settingSeismicGrid.value.benchmarkMagnitude;//基准震级
  if(str!=null && str!=""){
    str = str.toString();
    if(str.indexOf(".")==-1){
      str += ".0";
    }
    settingSeismicGrid.value.benchmarkMagnitude = str;//基准震级
    console.log("设置基准震级整数为1位小数:"+str);
  }
}

//保存点状设定地震
function saveSettingPoint(){
  //校验点状设定地震
  proxy.$refs["rulesFormPoint"].validate((vaild) => {
    if (!vaild) {
      alertMsg("校验失败！请检查必填项的数据正确性.");
      return;
    }
    if(settingSeismicPoint.value.isMagnitude=="2"){//2自定义
      //自定义震级改变事件
      let bool = customPointDomainsChange();
      if(bool==false){
        alertMsg("校验失败！请填写自定义震级（1位小数）.");
        return;
      }
    }
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicPoint.value.isAngle=="2"){
      if(settingSeismicPoint.value.angle===""){
        alertMsg("校验失败！请填写指定角度[0-180].");
        return;
      }else{
        let angle = settingSeismicPoint.value.angle;
        angle = Number(angle);
        if(Math.floor(angle)==angle && angle>=0 && angle<=180){
          //校验通过
        }else{
          alertMsg("校验失败！请填写指定角度[0-180].");
          return;
        }
      }
    }

    //Excel批量导入经纬度数组
    let lonlatArray = uploadExcelLonLatArray.value;
    if(lonlatArray && lonlatArray.length>0){//Excel批量导入点状设定地震经纬度
      proxy.$modal.confirm('是否确认保存?').then(function () {
        mapLoading("正在保存...");
        let lonlatsString = "";
        for(let i=0;i<lonlatArray.length;i++){
          let lonlat = lonlatArray[i];
          if(lonlatsString){
            lonlatsString += ";";
          }
          // //保留2位小数
          // let lon = Number(lonlat[0]).toFixed(2);
          // let lat = Number(lonlat[1]).toFixed(2);
          //保留5位小数
          let lon = Number(lonlat[0]).toFixed(5);
          let lat = Number(lonlat[1]).toFixed(5);
          lonlatsString += lon + "," + lat;
        }
        //查询全部经纬度点地址
        queryAllLonLatAddressExcelPoints(lonlatsString);
        //查询全部角度数组
        queryAllAngleArrayExcelPoints(lonlatsString);
      }).catch(() => {});
    }else{//单个点状设定地震
      //设定地震经纬度修改事件
      setPointLonLat();
      //修改经纬度事件
      let bool = false;
      let lonlatstr = pointLonLat.value;
      if(lonlatstr!="" && lonlatstr.indexOf(",")!=-1){
        let array = lonlatstr.split(",");
        if(array.length==2){
          let lon = array[0];
          let lat = array[1];
          //处理经纬度
          let lonlat = getLonLat(lon,lat);
          if(lonlat!=null){
            bool = true;
          }
        }
      }
      if(bool==false){
        alertMsg("校验失败！经纬度格式错误.");
        return;
      }
      //清空经纬度点地址解析字符串：经度,纬度,省,市,县
      lonlatAddressDataStr = "";
      let lon = lonlatstr.split(",")[0];
      let lat = lonlatstr.split(",")[1];
      //根据经纬度查询行政区划省市区县信息字符串（省,市,区县）
      queryProvinceCityCountyNameStringByLonLat({lon:lon,lat:lat}).then((response) => {
        nextTick(() => {
          console.log("地址解析");
          console.log(response.data);
          let pronvinceCityCountyName = response.data;//省,市,区县
          if(pronvinceCityCountyName===""){
            alertMsg("校验失败！经纬度未查到省市区县信息.");
            return;
          }
          //查询最近断层切线角度
          //queryNearDcAngle(lonlatstr);
          //经纬度点地址解析数组：经度,纬度,省,市,县,角度
          let dataStr = lonlatstr+","+pronvinceCityCountyName;
          console.log("经纬度点地址解析数组：经度,纬度,省,市,县");
          console.log(dataStr);
          //经纬度点地址解析字符串：经度,纬度,省,市,县
          lonlatAddressDataStr = dataStr;
          //显示点状设定地震面板
          showHidePointSetDivBool.value = true;
          //最近断层切线角度
          if(settingSeismicPoint.value.isAngle=="1"){
            mapLoading("正在查询最近断层切线角度...");
            //根据经纬度查询最近断层切线角度
            getClosestFaultageAngleBylonlatstr("save",lonlatstr);
          }else{
            //保存|更新点状设定地震
            saveUpdateSettingPoint();
          }
        });
      });
    }
  });
}

//保存|更新点状设定地震
function saveUpdateSettingPoint(){
  //经纬度点地址解析字符串：经度,纬度,省,市,县
  if(lonlatAddressDataStr===""){
    alertMsg("校验失败！经纬度未查到省市区县信息.");
    return;
  }
  let angle = "";
  //影响场角度选项：1最近断层切线角度 2指定角度
  if(settingSeismicPoint.value.isAngle=="1"){//最近断层切线角度
    //查询最近断层切线角度
    angle = nearDcDegree;
    if(angle===""){
      alertMsg("校验失败！未查到最近断层切线角度.");
      return;
    }
  }else{
    angle = settingSeismicPoint.value.angle;//指定角度
  }
  //经纬度,省市区县,角度字符串
  settingSeismicPoint.value.coordinates = lonlatAddressDataStr + "," + angle;
  let confirmtext = "是否确认保存?";
  if(lonlatInTaskRegionBool.value==false){
    confirmtext = "经纬度不在任务区域内，是否确认保存?";
  }
  //是否确认保存
  proxy.$modal.confirm(confirmtext).then(function () {
    mapLoading("正在保存...");
    //主键
    let id = settingSeismicPoint.value.ssId;
    console.log(id);
    if(id!=null && id!=""){//更新
      console.log("更新");
      console.log(settingSeismicPoint.value);
      //更新点状设定地震
      updateSettingSeismicPoint(settingSeismicPoint.value).then((response) => {
        nextTick(() => {
          let msg = response.message;
          console.log(msg);
          proxy.$modal.msgSuccess("保存成功");
          mapLoading(null);
          //关闭点状设定地震面板
          hidePointSetDiv();
        });
      });
    }else {//新增
      console.log("新增");
      settingSeismicPoint.value.faultNum = "";//清空序号
      console.log(settingSeismicPoint.value);
      //保存点状设定地震
      saveSettingSeismicPoint(settingSeismicPoint.value).then((response) => {
        nextTick(() => {
          let msg = response.message;
          console.log(msg);
          proxy.$modal.msgSuccess("保存成功");
          mapLoading(null);
          //关闭点状设定地震面板
          hidePointSetDiv();
        });
      });
    }
  }).catch(() => {});
}

//删除点状设定地震
function deleteSettingPoint(){
  let id = settingSeismicPoint.value.ssId;
  console.log(id);
  if(id!="") {
    proxy.$modal
        .confirm("请确认是否要删除？",)
        .then(function () {
          mapLoading("正在删除...");
          //删除点状设定地震
          deleteSettingSeismicPoint(settingSeismicPoint.value.ssId).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("删除成功");
              mapLoading(null);
              //关闭点状设定地震面板
              hidePointSetDiv();
            });
          });
        }).catch(() => {});
  }else{
    //关闭点状设定地震面板
    hidePointSetDiv();
  }
}

//保存断层设定地震
function saveSettingFault(){
  //校验断层设定地震
  proxy.$refs["rulesFormFault"].validate((vaild) => {
    if (!vaild) {
      alertMsg("校验失败！请检查必填项的数据正确性.");
      return;
    }
    console.log(settingSeismicFault.value);
    if(settingSeismicFault.value.isMagnitude=="2"){//2自定义
      //自定义震级改变事件
      let bool = customFaultDomainsChange();
      if(bool==false){
        alertMsg("校验失败！请填写自定义震级（1位小数）.");
        return;
      }
    }
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicFault.value.isAngle=="1"){
      settingSeismicFault.value.angle = "";
    }else if(settingSeismicFault.value.isAngle=="2"){
      if(settingSeismicFault.value.angle===""){
        alertMsg("校验失败！请填写指定角度[0-180].");
        return;
      }else{
        let angle = settingSeismicFault.value.angle;
        angle = Number(angle);
        if(Math.floor(angle)==angle && angle>=0 && angle<=180){
          //校验通过
        }else{
          alertMsg("校验失败！请填写指定角度[0-180].");
          return;
        }
      }
    }
    if (tempResultLonLatArray.value.length == 0) {
      alertMsg("请先生成震中位置!");
      return;
    }
    proxy.$modal.confirm('是否确认保存?').then(function () {
      mapLoading("正在保存...");
      //临时断层设定地震生成震中位置数组
      let resultLonLatArray = tempResultLonLatArray.value;
      if(resultLonLatArray!=null && resultLonLatArray.length>0){
        let lonlatsString = "";
        for(let i=0;i<resultLonLatArray.length;i++){
          let lonlat = resultLonLatArray[i];
          if(i>0){
            lonlatsString += ";";
          }
          lonlatsString += lonlat[0]+","+lonlat[1];
        }
        console.log("生成震中位置数组长度:"+resultLonLatArray.length);
        //查询全部经纬度点地址
        queryAllLonLatAddressFault(lonlatsString);
        //查询全部角度数组
        queryAllAngleArrayFault(lonlatsString);
      }
    }).catch(() => {});
  });
}

//更新断层设定地震
function updateSettingFault(){
  //校验断层设定地震
  proxy.$refs["rulesFormFault"].validate((vaild) => {
    if (!vaild) {
      alertMsg("校验失败！请检查必填项的数据正确性.");
      return;
    }
    if(settingSeismicFault.value.isMagnitude=="2"){//2自定义
      //自定义震级改变事件
      let bool = customFaultDomainsChange();
      if(bool==false){
        alertMsg("校验失败！请填写自定义震级（1位小数）.");
        return;
      }
    }
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicFault.value.isAngle=="1"){
      settingSeismicFault.value.angle = "";
    }else if(settingSeismicFault.value.isAngle=="2"){
      if(settingSeismicFault.value.angle===""){
        alertMsg("校验失败！请填写指定角度[0-180].");
        return;
      }else{
        let angle = settingSeismicFault.value.angle;
        angle = Number(angle);
        if(Math.floor(angle)==angle && angle>=0 && angle<=180){
          //校验通过
        }else{
          alertMsg("校验失败！请填写指定角度[0-180].");
          return;
        }
      }
    }
    if (tempResultLonLatArray.value.length == 0) {
      alertMsg("请先生成震中位置!");
      return;
    }
    console.log("tempResultLonLatArray.value");
    console.log(tempResultLonLatArray.value);
    proxy.$modal.confirm('是否确认保存?').then(function () {
      mapLoading("正在保存...");
      //临时断层设定地震生成震中位置数组
      let resultLonLatArray = tempResultLonLatArray.value;
      if(resultLonLatArray!=null && resultLonLatArray.length>0){
        let lonlatsString = "";
        for(let i=0;i<resultLonLatArray.length;i++){
          let lonlat = resultLonLatArray[i];
          if(i>0){
            lonlatsString += ";";
          }
          lonlatsString += lonlat[0]+","+lonlat[1];
        }
        console.log("生成震中位置数组长度:"+resultLonLatArray.length);
        //查询全部经纬度点地址
        queryAllLonLatAddressFault(lonlatsString);
        //查询全部角度数组
        queryAllAngleArrayFault(lonlatsString);
      }
    }).catch(() => {});
  });
}

//删除断层设定地震
function deleteSettingFault(){
  let id = settingSeismicFault.value.sfId;
  console.log(id);
  if(id!="") {
    proxy.$modal
        .confirm("请确认是否要删除？",)
        .then(function () {
          mapLoading("正在删除...");
          //删除断层设定地震
          deleteSettingSeismicFault(settingSeismicFault.value.sfId).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("删除成功");
              mapLoading(null);
              //关闭断层设定地震面板
              hideFaultSetDiv();
            });
          });
        }).catch(() => {});
  }else{
    //关闭断层设定地震面板
    hideFaultSetDiv();
  }
}

//保存公里格网设定地震
function saveSettingGrid(){
  //校验公里格网设定地震
  proxy.$refs["rulesFormGrid"].validate((vaild) => {
    if (!vaild) {
      alertMsg("校验失败！请检查必填项的数据正确性.");
      return;
    }
    console.log(settingSeismicGrid.value);
    if(settingSeismicGrid.value.isMagnitude=="2"){//2自定义
      //自定义震级改变事件
      let bool = customGridDomainsChange();
      if(bool==false){
        alertMsg("校验失败！请填写自定义震级（1位小数）.");
        return;
      }
    }
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicGrid.value.isAngle=="1"){
      settingSeismicGrid.value.angle = "";
    }else if(settingSeismicGrid.value.isAngle=="2"){
      if(settingSeismicGrid.value.angle===""){
        alertMsg("校验失败！请填写指定角度[0-180].");
        return;
      }else{
        let angle = settingSeismicGrid.value.angle;
        angle = Number(angle);
        if(Math.floor(angle)==angle && angle>=0 && angle<=180){
          //校验通过
        }else{
          alertMsg("校验失败！请填写指定角度[0-180].");
          return;
        }
      }
    }
    if (tempResultLonLatArray.value.length == 0) {
      alertMsg("请先生成震中位置!");
      return;
    }
    proxy.$modal.confirm('是否确认保存?').then(function () {
      mapLoading("正在保存...");
      //临时公里格网设定地震生成震中位置数组
      let resultLonLatArray = tempResultLonLatArray.value;
      if(resultLonLatArray!=null && resultLonLatArray.length>0){
        let lonlatsString = "";
        for(let i=0;i<resultLonLatArray.length;i++){
          let lonlat = resultLonLatArray[i];
          if(i>0){
            lonlatsString += ";";
          }
          lonlatsString += lonlat[0]+","+lonlat[1];
        }
        console.log("生成震中位置数组长度:"+resultLonLatArray.length);
        //查询全部经纬度点地址
        queryAllLonLatAddressGrid(lonlatsString);
        //查询全部角度数组
        queryAllAngleArrayGrid(lonlatsString);
      }
    }).catch(() => {});
  });
}

//更新公里格网设定地震
function updateSettingGrid(){
  //校验公里格网设定地震
  proxy.$refs["rulesFormGrid"].validate((vaild) => {
    if (!vaild) {
      alertMsg("校验失败！请检查必填项的数据正确性.");
      return;
    }
    if(settingSeismicGrid.value.isMagnitude=="2"){//2自定义
      //自定义震级改变事件
      let bool = customGridDomainsChange();
      if(bool==false){
        alertMsg("校验失败！请填写自定义震级（1位小数）.");
        return;
      }
    }
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicGrid.value.isAngle=="1"){
      settingSeismicGrid.value.angle = "";
    }else if(settingSeismicGrid.value.isAngle=="2"){
      if(settingSeismicGrid.value.angle===""){
        alertMsg("校验失败！请填写指定角度[0-180].");
        return;
      }else{
        let angle = settingSeismicGrid.value.angle;
        angle = Number(angle);
        if(Math.floor(angle)==angle && angle>=0 && angle<=180){
          //校验通过
        }else{
          alertMsg("校验失败！请填写指定角度[0-180].");
          return;
        }
      }
    }
    if (tempResultLonLatArray.value.length == 0) {
      alertMsg("请先生成震中位置!");
      return;
    }
    proxy.$modal.confirm('是否确认保存?').then(function () {
      mapLoading("正在保存...");
      //临时公里格网设定地震生成震中位置数组
      let resultLonLatArray = tempResultLonLatArray.value;
      if(resultLonLatArray!=null && resultLonLatArray.length>0){
        let lonlatsString = "";
        for(let i=0;i<resultLonLatArray.length;i++){
          let lonlat = resultLonLatArray[i];
          if(i>0){
            lonlatsString += ";";
          }
          lonlatsString += lonlat[0]+","+lonlat[1];
        }
        console.log("生成震中位置数组长度:"+resultLonLatArray.length);
        //查询全部经纬度点地址
        queryAllLonLatAddressGrid(lonlatsString);
        //查询全部角度数组
        queryAllAngleArrayGrid(lonlatsString);
      }
    }).catch(() => {});
  });
}

//删除公里格网设定地震
function deleteSettingGrid(){
  let id = settingSeismicGrid.value.sfId;
  console.log(id);
  if(id!="") {
    proxy.$modal
        .confirm("请确认是否要删除？",)
        .then(function () {
          mapLoading("正在删除...");
          //删除公里格网设定地震
          deleteSettingSeismicGrid(settingSeismicGrid.value.sfId).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("删除成功");
              mapLoading(null);
              //关闭公里格网设定地震面板
              hideGridSetDiv();
            });
          });
        }).catch(() => {});
  }else{
    //关闭公里格网设定地震面板
    hideGridSetDiv();
  }
}


//处理经纬度
function getLonLat(longitude,latitude){
  let lonlat = null;
  if(longitude!=null && latitude!=null && longitude!="" && latitude!=""){
    let lon = Number(longitude);
    let lat = Number(latitude);
    if(lon>0 && lon<180 && lat>0 && lat<90){
      lonlat = [lon,lat];
    }
  }

  return lonlat;
}

//查询最近断层切线角度
function queryNearDcAngle(lonlatstr){
  //最近断层切线角度
  let angle = "";
  if(lonlatstr!=null && lonlatstr!=""){
    //经纬度
    let longitude = lonlatstr.split(",")[0];
    let latitude = lonlatstr.split(",")[1];
    //处理经纬度
    let lonlat = getLonLat(longitude,latitude);
    if(lonlat!=null){
      let tempDistance = null;
      let tempIndex = null;
      let list = dcAllData.value;//断层数据
      for(let i=0;i<list.length;i++){
        let coordinates = list[i][1];
        //点到多段线的最短距离
        let distance = getPointDistanceByLineString(lonlat,coordinates);
        if(tempDistance==null){
          tempDistance = distance;
          tempIndex = i;
        }else if(distance<tempDistance){
          tempDistance = distance;//获取最短距离
          tempIndex = i;
        }
      }
      console.log(tempIndex+"获取最短距离"+tempDistance);
      if(tempIndex!=null){
        let lineCoordinates = list[tempIndex][1];//断层线经纬度
        console.log(lonlat);
        console.log(lineCoordinates);
        //计算点到多段线的最短距离的点经纬度（垂点）
        let pointlonlat = getLonLatByPointLine(lonlat,lineCoordinates);
        console.log(pointlonlat);
        let tempAngle = 0;
        if(lonlat[0]==pointlonlat[0] && lonlat[1]==pointlonlat[1]) {//Alon==Blon,Alat==Blat
          //计算断层角度
          for(let i=0;i<lineCoordinates.length;i++){
            if(lonlat[0]==lineCoordinates[i][0] && lonlat[1]==lineCoordinates[i][1]){
              if(i<(lineCoordinates.length-1)){
                //计算两不同点的连线的角度（正东为0）
                tempAngle = getAngleByPoints(lineCoordinates[i],lineCoordinates[i+1]);
              }else{
                //计算两不同点的连线的角度（正东为0）
                tempAngle = getAngleByPoints(lineCoordinates[i-1],lineCoordinates[i]);
              }
              break;
            }
          }
        }else{
          //计算两不同点的连线的垂直切线的角度（正东为0）
          tempAngle = getVerticalAngleByPoints(lonlat,pointlonlat);
        }
        //最近断层切线角度
        angle = tempAngle.toFixed(0).toString();
        console.log("最近断层切线角度:"+angle);
      }
      if(settingSeismicPoint.value.earthquakeType=="1") {//1点状
        //影响场角度选项：1最近断层切线角度 2指定角度
        if(settingSeismicPoint.value.isAngle=="1"){
          nearDcDegree = angle;//最近断层切线角度
          settingSeismicPoint.value.angle = angle;//最近断层切线角度
        }
      }
    }
  }

  return angle;
}

//计算两不同点的连线的垂直切线的角度（正东为0）
function getVerticalAngleByPoints(lonlat,pointlonlat){
  //计算两点间的角度
  let tempAngle = getAngleByPointsLonLat(lonlat,pointlonlat);
  console.log("两点角度"+tempAngle);
  if(tempAngle<0 && lonlat[0]>pointlonlat[0] && lonlat[1]>pointlonlat[1]){//Alon>Blon,Alat>Blat
    tempAngle = 0 - tempAngle;//取正
  }else if(tempAngle<0 && lonlat[0]>pointlonlat[0] && lonlat[1]<pointlonlat[1]) {//Alon>Blon,Alat<Blat
    tempAngle = 0 - tempAngle;//取正
  }else if(tempAngle>0 && lonlat[0]<pointlonlat[0] && lonlat[1]>pointlonlat[1]) {//Alon<Blon,Alat>Blat
    tempAngle = 180 - tempAngle;
  }else if(tempAngle>0 && lonlat[0]<pointlonlat[0] && lonlat[1]<pointlonlat[1]) {//Alon<Blon,Alat<Blat
    tempAngle = 180 - tempAngle;
  }else if(lonlat[0]==pointlonlat[0] && lonlat[1]>pointlonlat[1]) {//Alon==Blon,Alat>Blat
    tempAngle = 0;
  }else if(lonlat[0]==pointlonlat[0] && lonlat[1]<pointlonlat[1]) {//Alon==Blon,Alat<Blat
    tempAngle = 0;
  }else if(lonlat[0]>pointlonlat[0] && lonlat[1]==pointlonlat[1]) {//Alon>Blon,Alat==Blat
    tempAngle = 90;
  }else if(lonlat[0]<pointlonlat[0] && lonlat[1]==pointlonlat[1]) {//Alon<Blon,Alat==Blat
    tempAngle = 90;
  }

  return tempAngle;
}

//计算两不同点的连线的角度（正东为0）
function getAngleByPoints(lonlat,pointlonlat){
  //计算两不同点的连线的垂直切线的角度（正东为0）
  let tempAngle = getVerticalAngleByPoints(lonlat,pointlonlat);
  if(tempAngle==0){
    tempAngle = 90;
  }else if(tempAngle==90){
    tempAngle = 0;
  }else if(tempAngle > 90){
    tempAngle = 90 - tempAngle;
  }else if(tempAngle < 90){
    tempAngle = 90 + tempAngle;
  }

  return tempAngle;
}

//查询经纬度点地址
function queryLonLatAddress(lonlatstr,bool){
  //清空经纬度点地址解析字符串：经度,纬度,省,市,县
  lonlatAddressDataStr = "";
  let lon = lonlatstr.split(",")[0];
  let lat = lonlatstr.split(",")[1];
  if(lon!="" && lat!=""){
    //根据经纬度查询行政区划省市区县信息字符串（省,市,区县）
    queryProvinceCityCountyNameStringByLonLat({lon:lon,lat:lat}).then((response) => {
      nextTick(() => {
        console.log("地址解析");
        console.log(response.data);
        let pronvinceCityCountyName = response.data;//省,市,区县
        //查询最近断层切线角度
        //queryNearDcAngle(lonlatstr);
        //经纬度点地址解析数组：经度,纬度,省,市,县,角度
        let dataStr = lonlatstr+","+pronvinceCityCountyName;
        console.log("经纬度点地址解析数组：经度,纬度,省,市,县");
        console.log(dataStr);
        //经纬度点地址解析字符串：经度,纬度,省,市,县
        lonlatAddressDataStr = dataStr;
        //显示点状设定地震面板
        showHidePointSetDivBool.value = true;
        if(bool){
          //根据经纬度查询最近断层切线角度
          getClosestFaultageAngleBylonlatstr("query",lonlatstr);
        }else{
          mapLoading(null);
        }
      });
    });
  }
}

//生成震中位置--断层
function createSettingSeismicFault(){
  let list = dcAllData.value;//任务区域内的断层数据
  //let list = taskRegionDcDataArray.value;//任务区域内的断层数据
  if(list!=null && list.length>0){
    let regionCoordinateArray = taskRegionCoordinateArray.value;//任务区域经纬度数组
    let distanceFaultSet = Number(settingSeismicFault.value.distanceFault);//与断层起始点距离(公里)
    let intervalFaultSet = Number(settingSeismicFault.value.intervalFault);//按断层生成间隔(公里)
    console.log("生成震中位置");
    console.log("distanceFaultSet"+distanceFaultSet);
    console.log("intervalFaultSet"+intervalFaultSet);
    if(intervalFaultSet>=1 && intervalFaultSet<=50 && regionCoordinateArray.length>0){
      if (distanceFaultSet>=0) {
        mapLoading("正在生成...");
        let resultLonLatArray = [];
        for(let i=0;i<list.length;i++) {
          let coordinates = list[i][1];
          //console.log(coordinates);
          if(coordinates!=null && coordinates.length>=2){
            /*if(list[i].length==3){
              let bool = list[i][2];//断层线的最后一个点是否在任务区域内(不包括边线)，当bool为false时断层线经纬度数组顺序需要反转
              if(bool==false){//断层线经纬度数组顺序需要反转
                //逆转排序断层线经纬度数组
                coordinates.reverse();
                console.log("逆转排序断层线经纬度数组"+i);
              }
            }else{
              console.log("未查询断层线的最后一个点是否在任务区域内"+i);
            }*/
            let count = 0;//生成震中位置计数
            if(distanceFaultSet==0){//与断层起始点距离0
              let newLon0 = coordinates[0][0];
              let newLat0 = coordinates[0][1];
              // //保存2位小数
              // newLon0 = newLon0.toFixed(2);
              // newLat0 = newLat0.toFixed(2);
              //保存5位小数
              newLon0 = newLon0.toFixed(5);
              newLat0 = newLat0.toFixed(5);
              let newLonLat0 = [newLon0,newLat0];
              //判断新的经纬度是否与经纬度数组中数据不重复
              if(getLonLatArrayBool(resultLonLatArray,newLonLat0)){
                resultLonLatArray.push(newLonLat0);//添加震中位置--间隔intervalFault的第0个点（起始点）
              }else{
                console.log("重复"+newLonLat0);
              }
              count++;
            }
            let tempDistance = distanceFaultSet + (intervalFaultSet * count);//查询震中位置距离，单位公里
            //console.log(distanceFaultSet+","+intervalFaultSet+","+count+",tempDistance"+tempDistance);
            let distance = 0;//距离，单位米
            let lastDistance = 0;//上一距离，单位米
            for(let j=0;j<(coordinates.length-1);j++){
              lastDistance = distance;//上一距离
              //计数距离（公里）
              distance += getPointsDistance(coordinates[j],coordinates[j+1]) / 1000;
              //console.log(j+","+distance);
              while(distance >= tempDistance){
                //console.log("while(distance>=tempDistance:("+distance+","+tempDistance+")count:"+count);
                if(distance >= tempDistance){
                  if(distance==tempDistance){
                    let newLon = coordinates[j+1][0];
                    let newLat = coordinates[j+1][1];
                    // //保存2位小数
                    // newLon = newLon.toFixed(2);
                    // newLat = newLat.toFixed(2);
                    //保存5位小数
                    newLon = newLon.toFixed(5);
                    newLat = newLat.toFixed(5);
                    let newLonLat = [newLon,newLat];
                    //判断新的经纬度是否与经纬度数组中数据不重复
                    if(getLonLatArrayBool(resultLonLatArray,newLonLat)){
                      resultLonLatArray.push(newLonLat);//添加震中位置--间隔intervalFault的第count个点
                    }else{
                      console.log("重复"+newLonLat);
                    }
                  }else{
                    //计数比例
                    let temp = (tempDistance - lastDistance) / (distance - lastDistance);
                    let newLon = coordinates[j][0] + (coordinates[j+1][0] - coordinates[j][0]) * temp;
                    let newLat = coordinates[j][1] + (coordinates[j+1][1] - coordinates[j][1]) * temp;
                    // //保存2位小数
                    // newLon = newLon.toFixed(2);
                    // newLat = newLat.toFixed(2);
                    //保存5位小数
                    newLon = newLon.toFixed(5);
                    newLat = newLat.toFixed(5);
                    let newLonLat = [newLon,newLat];
                    //判断新的经纬度是否与经纬度数组中数据不重复
                    if(getLonLatArrayBool(resultLonLatArray,newLonLat)){
                      resultLonLatArray.push(newLonLat);//添加震中位置--间隔intervalFault的第count个点
                    }else{
                      console.log("重复"+newLonLat);
                    }
                  }
                  //增加1
                  count++;
                  tempDistance = distanceFaultSet + (intervalFaultSet * count);//查询震中位置距离，单位公里
                  //console.log("tempDistance"+tempDistance);
                  //console.log(j+","+distance);
                }
              }
            }
          }
        }
        console.log("震中位置数组");
        console.log(resultLonLatArray);
        //任务区域内的震中位置经纬度数组
        getAllLonLatsStringByTaskId(resultLonLatArray);//根据全部经纬度字符串获取任务区域内的经纬度字符串（多点相交）
      }else{
        alertMsg("请先设置与断层起始点距离!");
      }
    }else{
      alertMsg("请先设置按断层生成间隔(公里)!");
    }
  }else{
    alertMsg("任务区域内没有断层数据，无法生成震中位置！");
  }
}

//生成震中位置--公里格网
function createSettingSeismicGrid(){
  let regionCoordinateArray = taskRegionCoordinateArray.value;//任务区域经纬度数组
  let gridsSize = Number(settingSeismicGrid.value.gridsSize);//格网大小(公里)
  console.log("生成震中位置");
  console.log("gridsSize"+gridsSize);
  let id = taskUuid.value;
  if(gridsSize>=1 && gridsSize<=50 && regionCoordinateArray.length>0){
    mapLoading("正在生成...");
    let kilometer = gridsSize;
    //获取任务范围的正方形公里格网网格线和震中位置经纬度列表（以右上角为初始点）
    getSquareGridCenterLonLatList(id,kilometer).then((response) => {
      nextTick(() => {
        console.log("获取任务范围的正方形公里格网网格线和震中位置经纬度列表（以右上角为初始点）"+id);
        console.log(response.data);
        //任务范围的正方形公里格网网格线和震中位置经纬度列表
        squareGridCenterLonLatList.value = response.data;
        let list = response.data;
        let resultLonLatArray = [];
        if(list!=null && list.length==5){
          let centerLonList = list[3];//震中位置经度列表
          let centerLatList = list[4];//震中位置纬度列表
          //震中位置点
          if(centerLonList.length>0 && centerLatList.length>0) {
            for (let i = 0; i < centerLonList.length; i++) {
              let lon = centerLonList[i];
              // lon = Number(lon).toFixed(2);//保留2位小数
              lon = Number(lon).toFixed(5);//保留5位小数
              for (let j = 0; j < centerLatList.length; j++) {
                let lat = centerLatList[j];
                // lat = Number(lat).toFixed(2);//保留2位小数
                lat = Number(lat).toFixed(5);//保留5位小数
                let lonlat = getLonLat(lon, lat);
                if (lonlat != null) {
                  resultLonLatArray.push(lonlat);
                }
              }
            }
          }
        }
        console.log("震中位置数组");
        console.log(resultLonLatArray);
        //任务区域内的震中位置经纬度数组
        getAllLonLatsStringByTaskId(resultLonLatArray);//根据全部经纬度字符串获取任务区域内的经纬度字符串（多点相交）
      });
    });
  }else{
    alertMsg("请先设置格网大小(公里)!");
  }
}

//判断点是否在任务区域内(包含边线)
function judgeLonLatInPolygon(lonlat){
  let bool = false;
  //任务区域经纬度数组
  let allPointsArr = taskRegionCoordinateArray.value;
  if(allPointsArr!=null && allPointsArr.length>0){
    for(let i=0;i<allPointsArr.length;i++){
      let polygon = new Polygon(allPointsArr[i]);
      bool = polygon.intersectsCoordinate(lonlat);
      if(bool){
        break;
      }
    }
  }
  return bool;
}

//判断点是否在面边线上
function judgeLonLatInPolygonLine(allPointsArr,lonlat){
  let array = allPointsArr[0];
  let line = new LineString(array);
  let bool = line.intersectsCoordinate(lonlat);
  console.log("判断点是否在面边线上"+bool);

  return bool;
}

//根据容差判断两经纬度是否相等
function getBoolByLonLatTolerance(lonlat1,lonlat2,tolerance){
  let bool = false;
  if(lonlat1!=null && lonlat2!=null && tolerance>=0){
    let temp0 = Math.abs(lonlat1[0]-lonlat2[0]);
    let temp1 = Math.abs(lonlat1[1]-lonlat2[1]);
    if(temp0<=tolerance && temp1<=tolerance){
      bool = true;
    }
  }

  return bool;
}

//清空震中位置经纬度数组
function clearTempResultLonLatArray(){
  tempResultLonLatArray.value = [];
}

//判断新的经纬度是否与经纬度数组中数据不重复
function getLonLatArrayBool(lonlatArray,lonlat){
  let bool = true;//不重复
  if(lonlat!=null){
    if(lonlatArray!=null && lonlatArray.length>0 && lonlat!=null){
      for(let i=0;i<lonlatArray.length;i++){
        let temp = lonlatArray[i];
        if(temp[0]==lonlat[0] && temp[1]==lonlat[1]){
          bool = false;//重复
          break;
        }
      }
    }
  }else{
    bool = false;
  }

  return bool;
}

//根据全部经纬度字符串获取任务区域内的经纬度字符串（多点相交）
function getAllLonLatsStringByTaskId(lonlatArray){
  let taskId = taskUuid.value;
  let lonlatsString = "";
  if(lonlatArray.length>0){
    for(let i=0;i<lonlatArray.length;i++){
      let lonlat = lonlatArray[i];
      if(i>0){
        lonlatsString += ",";
      }
      lonlatsString += lonlat[0] + " " + lonlat[1];
    }
  }else{
    alertMsg("无震中位置，请重设参数.");
  }
  console.log("根据全部经纬度字符串获取任务区域内的经纬度字符串（多点相交）");
  //console.log(lonlatsString);
  if(lonlatsString!=""){
    getLonLatsStringByTaskId({taskId:taskId,lonlatsString:lonlatsString}).then((response) => {
      nextTick(() => {
        console.log("获取任务区域内的经纬度字符串（多点相交）");
        console.log(response.data);
        let resultString = response.data;
        if(resultString!=""){
          let resultLonLatArray = resultString.split(",");
          let newResultLonLatArray = [];
          for(let i=0;i<resultLonLatArray.length;i++){
            let newLonLatStr = resultLonLatArray[i];
            let newLonLat = newLonLatStr.split(" ");
            //经纬度
            if(newLonLat.length==2){
              let lon = newLonLat[0];
              let lat = newLonLat[1];
              let lonlat = getLonLat(lon, lat);
              if (lonlat != null) {
                //添加震中位置
                newResultLonLatArray.push(lonlat);
              }
            }
          }
          if(newResultLonLatArray.length>0){
            //临时断层设定地震、公里格网设定地震生成震中位置数组
            tempResultLonLatArray.value = newResultLonLatArray;
            proxy.$modal.msgSuccess("生成震中位置成功");
          }else{
            //临时断层设定地震、公里格网设定地震生成震中位置数组
            tempResultLonLatArray.value = [];
            alertMsg("无震中位置，请重设参数.");
          }
        }else{
          //临时断层设定地震、公里格网设定地震生成震中位置数组
          tempResultLonLatArray.value = [];
          alertMsg("无震中位置，请重设参数.");
        }
        mapLoading(null);
      });
    });
  }else{
    //临时断层设定地震、公里格网设定地震生成震中位置数组
    tempResultLonLatArray.value = [];
    alertMsg("无震中位置，请重设参数.");
    mapLoading(null);
  }
}

//查询全部经纬度点地址并保存--点状设定地震（Excel批量导入经纬度）
function queryAllLonLatAddressExcelPoints(lonlatsString){
  //console.log(lonlatsString);
  let taskId = taskUuid.value;
  allLonLatProvinceCityCountyNameString.value = "";//清空全部经纬度点地址字符串
  queryAddressDataStrArrayBool.value = false;//是否完成查询经纬度点地址解析数组
  if(lonlatsString!=""){
    console.log(taskId);
    queryAllLonLatProvinceCityCountyNameStringByLonLatsString({taskId:taskId,lonlatsString:lonlatsString}).then((response) => {
      nextTick(() => {
        console.log("地址解析");
        console.log(response.data);
        allLonLatProvinceCityCountyNameString.value = response.data;//查询全部经纬度点地址字符串
        queryAddressDataStrArrayBool.value = true;//是否完成查询经纬度点地址解析数组
        //完成查询地址、角度并保存--点状设定地震（Excel批量导入经纬度）
        completeQueryAddressAngleSaveUpdateExcelPoints();
      });
    });
  }
}

//查询全部经纬度点地址并保存--断层
function queryAllLonLatAddressFault(lonlatsString){
  //console.log(lonlatsString);
  let taskId = taskUuid.value;
  allLonLatProvinceCityCountyNameString.value = "";//清空全部经纬度点地址字符串
  queryAddressDataStrArrayBool.value = false;//是否完成查询经纬度点地址解析数组
  if(lonlatsString!=""){
    console.log(taskId);
    queryAllLonLatProvinceCityCountyNameStringByLonLatsString({taskId:taskId,lonlatsString:lonlatsString}).then((response) => {
      nextTick(() => {
        console.log("地址解析");
        //console.log(response.data);
        allLonLatProvinceCityCountyNameString.value = response.data;//查询全部经纬度点地址字符串
        queryAddressDataStrArrayBool.value = true;//是否完成查询经纬度点地址解析数组
        //完成查询地址、角度并保存|更新--断层
        completeQueryAddressAngleSaveUpdateFault();
      });
    });
  }
}

//查询全部经纬度点地址并保存--公里格网
function queryAllLonLatAddressGrid(lonlatsString){
  //console.log(lonlatsString);
  let taskId = taskUuid.value;
  allLonLatProvinceCityCountyNameString.value = "";//清空全部经纬度点地址字符串
  queryAddressDataStrArrayBool.value = false;//是否完成查询经纬度点地址解析数组
  if(lonlatsString!=""){
    queryAllLonLatProvinceCityCountyNameStringByLonLatsString({taskId:taskId,lonlatsString:lonlatsString}).then((response) => {
      nextTick(() => {
        console.log("地址解析");
        //console.log(response.data);
        allLonLatProvinceCityCountyNameString.value = response.data;//查询全部经纬度点地址字符串
        queryAddressDataStrArrayBool.value = true;//是否完成查询经纬度点地址解析数组
        //完成查询地址、角度并保存|更新--公里格网
        completeQueryAddressAngleSaveUpdateGrid();
      });
    });
  }
}

//查询全部角度数组--点状设定地震（Excel批量导入经纬度）
function queryAllAngleArrayExcelPoints(lonlatsString){
  //清空全部角度数组
  allAngleDataArray.value = [];
  queryAllAngleDataArrayBool.value = false;//是否完成查询全部角度数组
  if(lonlatsString!=""){
    let lonlatstrArray = lonlatsString.split(";");
    let angleList = [];
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicPoint.value.isAngle=="1"){//最近断层切线角度
      //根据全部经纬度字符串批量查询最近断层切线角度列表
      queryClosestFaultageAngleListByLonLatsString("1",lonlatsString);
    }else if(settingSeismicPoint.value.isAngle=="2") {//指定角度
      let angle = settingSeismicPoint.value.angle;//指定角度
      if(angle===""){
        mapLoading(null);
        alertMsg("无指定角度，请设置指定角度.");
      }else{
        for(let i=0;i<lonlatstrArray.length;i++) {
          angleList.push(angle);
        }
        allAngleDataArray.value = angleList;//全部角度数组
        queryAllAngleDataArrayBool.value = true;//是否完成查询全部角度数组
        //完成查询地址、角度并保存--点状设定地震（Excel批量导入经纬度）
        completeQueryAddressAngleSaveUpdateExcelPoints();
      }
    }
  }
}

//查询全部角度数组--断层
function queryAllAngleArrayFault(lonlatsString){
  //清空全部角度数组
  allAngleDataArray.value = [];
  queryAllAngleDataArrayBool.value = false;//是否完成查询全部角度数组
  if(lonlatsString!=""){
    let lonlatstrArray = lonlatsString.split(";");
    let angleList = [];
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicFault.value.isAngle=="1"){//最近断层切线角度
      //根据全部经纬度字符串批量查询最近断层切线角度列表
      queryClosestFaultageAngleListByLonLatsString("2",lonlatsString);
    }else if(settingSeismicFault.value.isAngle=="2") {//指定角度
      let angle = settingSeismicFault.value.angle;//指定角度
      if(angle===""){
        mapLoading(null);
        alertMsg("无指定角度，请设置指定角度.");
      }else{
        for(let i=0;i<lonlatstrArray.length;i++) {
          angleList.push(angle);
        }
        allAngleDataArray.value = angleList;//全部角度数组
        queryAllAngleDataArrayBool.value = true;//是否完成查询全部角度数组
        //完成查询地址、角度并保存|更新--断层
        completeQueryAddressAngleSaveUpdateFault();
      }
    }
  }
}

//查询全部角度数组--公里格网
function queryAllAngleArrayGrid(lonlatsString){
  //清空全部角度数组
  allAngleDataArray.value = [];
  queryAllAngleDataArrayBool.value = false;//是否完成查询全部角度数组
  if(lonlatsString!=""){
    let lonlatstrArray = lonlatsString.split(";");
    let angleList = [];
    //影响场角度选项：1最近断层切线角度 2指定角度
    if(settingSeismicGrid.value.isAngle=="1"){//最近断层切线角度
      //根据全部经纬度字符串批量查询最近断层切线角度列表
      queryClosestFaultageAngleListByLonLatsString("3",lonlatsString);
    }else if(settingSeismicGrid.value.isAngle=="2") {//指定角度
      let angle = settingSeismicGrid.value.angle;//指定角度
      if(angle===""){
        mapLoading(null);
        alertMsg("无指定角度，请设置指定角度.");
      }else{
        for(let i=0;i<lonlatstrArray.length;i++) {
          angleList.push(angle);
        }
        allAngleDataArray.value = angleList;//全部角度数组
        queryAllAngleDataArrayBool.value = true;//是否完成查询全部角度数组
        //完成查询地址、角度并保存|更新--公里格网
        completeQueryAddressAngleSaveUpdateGrid();
      }
    }
  }
}

//完成查询地址、角度并保存--点状设定地震（Excel批量导入经纬度）
function completeQueryAddressAngleSaveUpdateExcelPoints(){
  //是否完成查询经纬度点地址解析数组
  //是否完成查询全部角度数组
  if(queryAddressDataStrArrayBool.value==true && queryAllAngleDataArrayBool.value==true){
    queryAddressDataStrArrayBool.value = false;
    queryAllAngleDataArrayBool.value = false;
    console.log("完成查询地址、角度并保存|更新");
    let angleList = allAngleDataArray.value;//全部角度数组
    let allString = allLonLatProvinceCityCountyNameString.value;//查询全部经纬度点地址字符串
    console.log(allString);
    console.log(angleList);
    if(allString!="" && angleList.length>0){
      let allArr = allString.split(";");
      if(allArr!=null && allArr.length>0 && allArr.length==angleList.length){
        let allDataStr = "";
        for(let i=0;i<allArr.length;i++){
          //经度,纬度,省,市,县
          let lonLatProvinceCityCountyName = allArr[i];
          let angle = angleList[i];//影响场角度
          if(i>0){
            allDataStr += ";";
          }
          //经纬度点地址解析数组：经度,纬度,省,市,县,角度;
          allDataStr += lonLatProvinceCityCountyName+","+angle;
        }
        //经纬度,省市区县,角度
        settingSeismicPoint.value.coordinates = allDataStr;
        console.log("经纬度,省市区县，角度字符串");
        console.log(settingSeismicPoint.value.coordinates);
        console.log("批量新增点状设定地震");
        console.log(settingSeismicPoint.value);
        //批量保存点状设定地震
        saveSettingSeismicPoint2(settingSeismicPoint.value).then((response) => {
          nextTick(() => {
            let msg = response.message;
            console.log(msg);
            proxy.$modal.msgSuccess("保存成功");
            mapLoading(null);
            //关闭点状设定地震面板
            hidePointSetDiv();
          });
        });
      }
    }
  }
}

//完成查询地址、角度并保存|更新--断层
function completeQueryAddressAngleSaveUpdateFault(){
  //是否完成查询经纬度点地址解析数组
  //是否完成查询全部角度数组
  if(queryAddressDataStrArrayBool.value==true && queryAllAngleDataArrayBool.value==true){
    queryAddressDataStrArrayBool.value = false;
    queryAllAngleDataArrayBool.value = false;
    console.log("完成查询地址、角度并保存|更新");
    let angleList = allAngleDataArray.value;//全部角度数组
    let allString = allLonLatProvinceCityCountyNameString.value;//查询全部经纬度点地址字符串
    console.log(allString);
    console.log(angleList);
    if(allString!="" && angleList.length>0){
      let allArr = allString.split(";");
      if(allArr!=null && allArr.length>0 && allArr.length==angleList.length){
        let allDataStr = "";
        for(let i=0;i<allArr.length;i++){
          //经度,纬度,省,市,县
          let lonLatProvinceCityCountyName = allArr[i];
          let angle = angleList[i];//影响场角度
          if(i>0){
            allDataStr += ";";
          }
          //经纬度点地址解析数组：经度,纬度,省,市,县,角度;
          allDataStr += lonLatProvinceCityCountyName+","+angle;
        }
        //经纬度,省市区县,角度
        settingSeismicFault.value.coordinates = allDataStr;
        console.log("经纬度,省市区县，角度字符串");
        console.log(settingSeismicFault.value.coordinates);
        //主键
        let id = settingSeismicFault.value.sfId;
        if(id!=null && id!=""){//更新
          console.log("更新断层设定地震");
          console.log(settingSeismicFault.value);
          //更新断层设定地震
          saveSettingSeismicFault(settingSeismicFault.value).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("保存成功");
              mapLoading(null);
              //关闭断层设定地震面板
              hideFaultSetDiv();
            });
          });
        }else {//新增
          console.log("新增断层设定地震");
          console.log(settingSeismicFault.value);
          //保存断层设定地震
          saveSettingSeismicFault(settingSeismicFault.value).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("保存成功");
              mapLoading(null);
              //关闭断层设定地震面板
              hideFaultSetDiv();
            });
          });
        }
      }
    }
  }
}

//完成查询地址、角度并保存|更新--公里格网
function completeQueryAddressAngleSaveUpdateGrid(){
  //是否完成查询经纬度点地址解析数组
  //是否完成查询全部角度数组
  if(queryAddressDataStrArrayBool.value==true && queryAllAngleDataArrayBool.value==true){
    queryAddressDataStrArrayBool.value = false;
    queryAllAngleDataArrayBool.value = false;
    console.log("完成查询地址、角度并保存|更新");
    let angleList = allAngleDataArray.value;//全部角度数组
    let allString = allLonLatProvinceCityCountyNameString.value;//查询全部经纬度点地址字符串
    console.log(allString);
    console.log(angleList);
    if(allString!=null && allString!="" && angleList.length>0){
      let allArr = allString.split(";");
      if(allArr!=null && allArr.length>0 && allArr.length==angleList.length){
        let allDataStr = "";
        for(let i=0;i<allArr.length;i++){
          //经度,纬度,省,市,县
          let lonLatProvinceCityCountyName = allArr[i];
          let angle = angleList[i];//影响场角度
          if(i>0){
            allDataStr += ";";
          }
          //经纬度点地址解析数组：经度,纬度,省,市,县,角度;
          allDataStr += lonLatProvinceCityCountyName+","+angle;
        }
        //经纬度,省市区县,角度
        settingSeismicGrid.value.coordinates = allDataStr;
        console.log("经纬度,省市区县，角度字符串");
        console.log(settingSeismicGrid.value.coordinates);
        //主键
        let id = settingSeismicGrid.value.sfId;
        if(id!=null && id!=""){//更新
          console.log("更新公里格网设定地震");
          console.log(settingSeismicGrid.value);
          //更新公里格网设定地震
          saveSettingSeismicGrid(settingSeismicGrid.value).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("保存成功");
              mapLoading(null);
              //关闭公里格网设定地震面板
              hideGridSetDiv();
            });
          });
        }else {//新增
          console.log("新增公里格网设定地震");
          console.log(settingSeismicGrid.value);
          //保存公里格网设定地震
          saveSettingSeismicGrid(settingSeismicGrid.value).then((response) => {
            nextTick(() => {
              let msg = response.message;
              console.log(msg);
              proxy.$modal.msgSuccess("保存成功");
              mapLoading(null);
              //关闭公里格网设定地震面板
              hideGridSetDiv();
            });
          });
        }
      }
    }else{
      alertMsg("未查到省市县信息，保存失败.");
      mapLoading(null);
    }
  }
}

//获取任务信息
function getTaskInfo(){
  upload.uploadData.taskId = route.query.id;//设置上传Excel文件的任务ID参数
  taskUuid.value = route.query.id;
  taskType.value = route.query.taskType;
  pattern.value = route.query.pattern;
  returnPageName.value = route.query.name;
  if(route.query.type=="1"){//点状设定地震
    pageType.value = "1";//页面类型：1点状2断层3公里格网
  }else if(route.query.type=="2"){//断层设定地震
    pageType.value = "2";//页面类型：1点状2断层3公里格网
  }else if(route.query.type=="3"){//公里格网设定地震
    pageType.value = "3";//页面类型：1点状2断层3公里格网
  }
  let id = taskUuid.value;
  if(id!=null && id!=undefined){
    console.log(id);
    queryParams.value.taskId = id;//任务主键ID
    settingSeismicPoint.value.taskId = id;//任务主键ID
    settingSeismicFault.value.taskId = id;//任务主键ID
    settingSeismicGrid.value.taskId = id;//任务主键ID
    //显示地图
    completeRefreshSettingPoint.value = true;
    //查询任务信息
    getTaskInfoById(id).then((response) => {
      nextTick(() => {
        console.log("查询任务"+id);
        console.log(response.data);
        //任务区域经纬度
        taskRegion.value = response.data.taskRegion;
        //任务地区
        taskDistrict.value = response.data.taskDistrict;
        //获取任务区域经纬度数组
        getTaskRegionCoordinateArray();
        console.log("获取任务区域经纬度数组");
        console.log(taskRegionCoordinateArray.value);
        //获取任务区域断层信息
        getFaultByTaskId();
        //根据任务ID获取任务区域内的相交的断层信息
        // getIntersectionFaultById();
        //初始化查询任务全部设定地震
        initQueryAllSetting();
        //获取任务范围的正方形公里格网网格线和震中位置经纬度列表（以右上角为初始点）
        //getSquareGridCenterLonLatListByTaskIdKilometer();
        //显示地图
        //completeRefreshSettingPoint.value = true;
      });
    });
  }
}

//获取任务区域经纬度数组
function getTaskRegionCoordinateArray(){
  let regionStr = taskRegion.value;
  //任务区域经纬度数组
  taskRegionCoordinateArray.value = [];
  if(regionStr.indexOf("MULTIPOLYGON")==-1) {//地图绘制区域
    console.log("地图绘制区域");
    let coordinates = [];
    let arr = regionStr.split(";");
    if(arr!=null && arr.length>0){
      for(let j=0;j<arr.length;j++){
        let lonlatStr = arr[j].split(",");
        let lonlat = [];
        lonlat.push(Number(lonlatStr[0]));
        lonlat.push(Number(lonlatStr[1]));
        coordinates.push(lonlat);
      }
    }
    let allPointsArr = [coordinates];
    //任务区域经纬度数组
    taskRegionCoordinateArray.value.push(allPointsArr);
  }else{//行政区划选择区域
    console.log("行政区划选择区域");
    let allCoordinates = [];
    let all_coords_str = regionStr.split(";");
    for(let i=0;i<all_coords_str.length;i++){
      let coords_str = all_coords_str[i].split("MULTIPOLYGON (((")[1].split(")))")[0];
      if(coords_str.indexOf(")), ((")!=-1){
        console.log("多个的面");
      }
      let geometries = coords_str.split(")), ((");
      for (let k = 0;k < geometries.length;k++) {
        //console.log(geometries[k]);
        let allPointsArr = [];
        if(coords_str.indexOf("), (")!=-1){
          //console.log("镂空的面");
        }
        let __coords = geometries[k].split("), (");
        //console.log("__coords: ", __coords.length);
        for (let m = 0;m < __coords.length;m++) {
          let _coords = __coords[m].split(", "), points = [];
          //console.log(_coords);
          for (let n = 0;n < _coords.length;n++) {
            if(_coords[n]!=null && _coords[n]!=""){
              let coord = _coords[n].split(" ");
              let lon = Number(coord[0]), lat = Number(coord[1]);
              let lonlat = [lon, lat];
              points.push(lonlat);
              allCoordinates.push(lonlat);
            }
          }
          allPointsArr.push(points);
          //不对空洞的面进行相交处理
          break;
        }
        //任务区域经纬度数组
        taskRegionCoordinateArray.value.push(allPointsArr);
      }
    }
  }
}

//获取任务区域断层信息
function getFaultByTaskId(){
  let id = taskUuid.value;
  console.log("查询任务区域断层信息"+id);
  //查询任务区域内的断层信息
  // getFaultById(id).then((response) => {
  //根据任务ID获取任务区域内的相交的断层信息
  getIntersectionFaultByTaskId(id).then((response) => {
    nextTick(() => {
      console.log("查询任务区域断层信息结果"+id);
      console.log(response.data);
      let list = response.data;//任务区域断层信息数组
      if(list!=null && list.length>0){
        let allDcLinePointsArray = [];
        for(let i=0;i<list.length;i++){
          let id = list[i].fauId;//主键ID
          let geomText = list[i].geomText;
          if(geomText!=null && geomText!=""){
            if(geomText.indexOf("MULTILINESTRING((")!=-1){//多线
              let coords_str = geomText.split("MULTILINESTRING((")[1].split("))")[0];
              let _coordsArr = coords_str.split("),(");
              for(let j=0;j<_coordsArr.length;j++){
                let _coords = _coordsArr[j].split(",");
                if(_coords.length>0){
                  let allPointsArr = [];
                  for (let n = 0;n < _coords.length;n++) {
                    if(_coords[n]!=null && _coords[n]!=""){
                      let coord = _coords[n].split(" ");
                      //处理经纬度
                      let lonlat = getLonLat(coord[0],coord[1]);
                      if(lonlat!=null){
                        allPointsArr.push(lonlat);
                      }
                    }
                  }
                  if(allPointsArr.length>0){
                    allDcLinePointsArray.push([id,allPointsArr]);
                  }
                }
              }
            }else if(geomText.indexOf("LINESTRING(")!=-1){//线段
              let coords_str = geomText.split("LINESTRING(")[1].split(")")[0];
              let _coords = coords_str.split(",");
              if(_coords.length>0){
                let allPointsArr = [];
                for (let n = 0;n < _coords.length;n++) {
                  if(_coords[n]!=null && _coords[n]!=""){
                    let coord = _coords[n].split(" ");
                    //处理经纬度
                    let lonlat = getLonLat(coord[0],coord[1]);
                    if(lonlat!=null){
                      allPointsArr.push(lonlat);
                    }
                  }
                }
                if(allPointsArr.length>0){
                  allDcLinePointsArray.push([id,allPointsArr]);
                }
              }
            }
          }
        }
        //断层图层
        dcAllData.value = allDcLinePointsArray;
      }
    });
  });
}

/*//根据任务ID获取任务区域内的相交的断层信息
function getIntersectionFaultById(){
  let id = taskUuid.value;
  console.log("根据任务ID获取任务区域内的相交的断层信息"+id);
  //清空任务区域断层信息数组
  taskRegionDcDataArray.value = [];
  //根据任务ID获取任务区域内的相交的断层信息
  getIntersectionFaultByTaskId(id).then((response) => {
    nextTick(() => {
      console.log("查询任务区域内的相交的断层信息"+id);
      console.log(response.data);
      let list = response.data;//任务区域断层信息数组
      if(list!=null && list.length>0){
        let allDcLinePointsArray = [];
        for(let i=0;i<list.length;i++){
          let id = list[i].fauId;//主键ID
          let geomText = list[i].geomText;
          if(geomText!=null && geomText!=""){
            if(geomText.indexOf("MULTILINESTRING((")!=-1){//多线
              let coords_str = geomText.split("MULTILINESTRING((")[1].split("))")[0];
              let _coordsArr = coords_str.split("),(");
              for(let j=0;j<_coordsArr.length;j++){
                let _coords = _coordsArr[j].split(",");
                if(_coords.length>0){
                  let allPointsArr = [];
                  for (let n = 0;n < _coords.length;n++) {
                    if(_coords[n]!=null && _coords[n]!=""){
                      let coord = _coords[n].split(" ");
                      //处理经纬度
                      let lonlat = getLonLat(coord[0],coord[1]);
                      if(lonlat!=null){
                        allPointsArr.push(lonlat);
                      }
                    }
                  }
                  if(allPointsArr.length>0){
                    allDcLinePointsArray.push([id,allPointsArr]);
                  }
                }
              }
            }else if(geomText.indexOf("LINESTRING(")!=-1){//线段
              let coords_str = geomText.split("LINESTRING(")[1].split(")")[0];
              let _coords = coords_str.split(",");
              if(_coords.length>0){
                let allPointsArr = [];
                for (let n = 0;n < _coords.length;n++) {
                  if(_coords[n]!=null && _coords[n]!=""){
                    let coord = _coords[n].split(" ");
                    //处理经纬度
                    let lonlat = getLonLat(coord[0],coord[1]);
                    if(lonlat!=null){
                      allPointsArr.push(lonlat);
                    }
                  }
                }
                if(allPointsArr.length>0){
                  allDcLinePointsArray.push([id,allPointsArr]);
                }
              }
            }
          }
        }
        //任务区域断层信息数组
        taskRegionDcDataArray.value = allDcLinePointsArray;
      }
    });
  });
}*/

//根据任务ID查询任务区域行政区划code列表
function getAllCodeList(){
  let id = taskUuid.value;
  console.log("任务区域行政区划code列表"+id);
  //查询任务信息
  getAllCodeListByTaskId(id).then((response) => {
    nextTick(() => {
      console.log("查询任务区域行政区划code列表结果"+id);
      console.log(response.data);
    });
  });
}

/*//判断经纬度是否在面内部（不包括边线）
function isTaskRegionContainsLonLatById(lonlat,index){
  //lonlat = "116 39";
  let taskId = taskUuid.value;
  let bool = false;
  if(taskId!=null && taskId!="" && lonlat!=null && lonlat!=""){
    isTaskRegionContainsLonLat({taskId:taskId,lonlat:lonlat}).then((response) => {
      nextTick(() => {
        console.log(response.data);
        bool = response.data;
        taskRegionDcDataArray.value[index].push(bool);
        console.log(index+"判断经纬度是否在面内部（不包括边线）"+bool);
      });
    });
  }

  return bool;
}

//判断经纬度是否在任务区域边线上（不包括区域内部）
function isTaskRegionTouchesLonLatById(lonlat,index){
  //lonlat = "116 39";
  let taskId = taskUuid.value;
  let bool = false;
  if(taskId!=null && taskId!="" && lonlat!=null && lonlat!=""){
    isTaskRegionTouchesLonLat({taskId:taskId,lonlat:lonlat}).then((response) => {
      nextTick(() => {
        console.log(response.data);
        bool = response.data;
        taskRegionDcDataArray.value[index].push(bool);
        console.log(index+"判断经纬度是否在任务区域边线上（不包括区域内部）"+bool);
      });
    });
  }

  return bool;
}*/

//获取任务范围的正方形公里格网网格线和震中位置经纬度列表（以右上角为初始点）
function getSquareGridCenterLonLatListByTaskIdKilometer(){
  let id = taskUuid.value;
  let kilometer = 2;
  //获取任务范围的正方形公里格网网格线和震中位置经纬度列表（以右上角为初始点）
  getSquareGridCenterLonLatList(id,kilometer).then((response) => {
    nextTick(() => {
      console.log("获取任务范围的正方形公里格网网格线和震中位置经纬度列表（以右上角为初始点）"+id);
      console.log(response.data);
      //任务范围的正方形公里格网网格线和震中位置经纬度列表
      squareGridCenterLonLatList.value = response.data;
    });
  });
}

//根据经纬度查询最近断层切线角度
function getClosestFaultageAngleBylonlatstr(type,lonlatstr){
  if(lonlatstr!=null && lonlatstr!=""){
    //经纬度
    let longitude = lonlatstr.split(",")[0];
    let latitude = lonlatstr.split(",")[1];
    //处理经纬度
    let lonlat = getLonLat(longitude,latitude);
    if(lonlat!=null){
      //根据经纬度查询最近断层切线角度（与正东方向的夹角，[0,180]）
      getClosestFaultageAngleByLonLat({lon:longitude,lat:latitude}).then((response) => {
        nextTick(() => {
          console.log("根据经纬度查询最近断层切线角度");
          console.log(response.data);
          let angle = "";
          let tempAngle = response.data;
          if(tempAngle!=null && tempAngle!=""){
            //最近断层切线角度--取整数
            angle = Number(tempAngle).toFixed(0).toString();
            console.log("最近断层切线角度:"+angle);
          }else{
            //警告消息
            alertMsg("无最近断层切线角度，请设置指定角度.");
          }
          nearDcDegree = angle;//最近断层切线角度
          if(settingSeismicPoint.value.earthquakeType=="1") {//1点状
            //影响场角度选项：1最近断层切线角度 2指定角度
            if(settingSeismicPoint.value.isAngle=="1"){
              //nearDcDegree = angle;//最近断层切线角度
              settingSeismicPoint.value.angle = angle;//最近断层切线角度
            }
          }
          if(type=="query"){
            mapLoading(null);
          }else if(type=="save"){
            mapLoading(null);
            //保存|更新点状设定地震
            saveUpdateSettingPoint();
          }
        });
      });
    }
  }
}

//根据全部经纬度字符串批量查询最近断层切线角度列表
function queryClosestFaultageAngleListByLonLatsString(type,lonlatsString){
  let taskId = taskUuid.value;
  //根据全部经纬度字符串批量查询最近断层切线角度列表（与正东方向的夹角，[0,180]）
  getClosestFaultageAngleListByLonLatsString({taskId:taskId,lonlatsString:lonlatsString}).then((response) => {
    nextTick(() => {
      console.log("根据全部经纬度字符串批量查询最近断层切线角度列表");
      console.log(response.data);
      let resultList = response.data;
      if(resultList!=null && resultList.length>0){
        let angleList = [];
        for(let i=0;i<resultList.length;i++){
          //最近断层切线角度--取整数
          let angle = Number(resultList[i]).toFixed(0).toString();
          angleList.push(angle);
        }
        allAngleDataArray.value = angleList;//全部角度数组
        queryAllAngleDataArrayBool.value = true;//是否完成查询全部角度数组
        if(type=="1"){
          //完成查询地址、角度并保存--点状设定地震（Excel批量导入经纬度）
          completeQueryAddressAngleSaveUpdateExcelPoints();
        }else if(type=="2"){
          //完成查询地址、角度并保存|更新--断层
          completeQueryAddressAngleSaveUpdateFault();
        }else if(type=="3"){
          //完成查询地址、角度并保存|更新--公里格网
          completeQueryAddressAngleSaveUpdateGrid();
        }
      }else{
        mapLoading(null);
        alertMsg("无最近断层切线角度，请设置指定角度.");
      }
    });
  });
}

//获取任务信息
getTaskInfo();
//根据任务ID查询任务区域行政区划code列表
//getAllCodeList();

</script>
<style scoped lang="scss">
/*点状设定地震面板*/
.new-pointSetDiv {
  position:absolute;
  top:1px;
  right:20px;
  width:360px;
  background-color:#fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}
.new-pointSetDiv-head {
  position: relative;
  top: 0px;
  left: 0px;
  right: 0px;
  height: 40px;
  padding: 10px;
  background: #1890ff;
}
.new-pointSetDiv-head span {
  position: absolute;
  color: #fff;
}
.new-pointSetDiv-inner {
  position: relative;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  padding: 20px;
  padding-left: 0px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 478px;
}

/*断层设定地震面板*/
.new-faultSetDiv {
  position:absolute;
  top:2px;
  right:20px;
  width:410px;
  background-color:#fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}
.new-faultSetDiv-head {
  position: relative;
  top: 0px;
  left: 0px;
  right: 0px;
  height: 40px;
  padding: 10px;
  background: #1890ff;
}
.new-faultSetDiv-head span {
  position: absolute;
  color: #fff;
}
.new-faultSetDiv-inner {
  position: relative;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  padding: 20px;
  padding-left: 0px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 478px;
}

/*公里格网设定地震面板*/
.new-gridSetDiv {
  position:absolute;
  top:2px;
  right:20px;
  width:410px;
  background-color:#fff;
  box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
  border:1px solid #707070;
  border-radius: 4px;
}
.new-gridSetDiv-head {
  position: relative;
  top: 0px;
  left: 0px;
  right: 0px;
  height: 40px;
  padding: 10px;
  background: #1890ff;
}
.new-gridSetDiv-head span {
  position: absolute;
  color: #fff;
}
.new-gridSetDiv-inner {
  position: relative;
  top: 0px;
  left: 0px;
  right: 0px;
  bottom: 0px;
  padding: 20px;
  padding-left: 0px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: 478px;
}

//下方查看详情面板
.new-queryResultDiv {
  position: absolute;
  left:0px;
  right:0px;
  bottom:0px;
  /*height:140px;*/
  height:200px;
  background:#fff;
  z-index: 10;
  border: 1px solid #e4e7ed;
}
.new-queryTableBtn {
  position: absolute;
  left:0px;
  right:0px;
  top:0px;
  height:50px;
  padding:10px;
}
.new-queryTableSpan{
  position: relative;
  top: -32px;
  width: 100%;
  text-align: center;
  font-weight: bold;
  font-size: 18px;
  color: var(--el-color-primary);
  display: inline-block;
  line-height: 32px;
  z-index: -1;
}
.new-queryTableDiv {
  position: absolute;
  left:0px;
  right:0px;
  top:50px;
  bottom:0px;
}

/*设定地震图层图例*/
.new-setEarthquakeLegendDiv {
  position: absolute;
  bottom: 0px;
  right: 0px;
  background: #fff;
  box-shadow: 0px 0px 20px rgb(0 0 0 / 20%);
  border: 1px solid #707070;
  border-radius: 4px;
  padding: 5px;
}
.new-setEarthquakeLegendDiv div {
  position: relative;
  height: 16px;
  line-height: 16px;
  font-size: 13px;
  margin: 8px;
}
.new-setEarthquakeLegendDiv div span {
  line-height: 16px;
  font-size: 13px;
}
.new-setEarthquakeLegendDiv div div {
  position: relative;
  top: 2px;
  left: 8px;
  width: 30px;
  height: 14px;
  margin: 0px !important;
  margin-right: 25px !important;
  display: inline-block;
}

/*面*/
.new-legendDiv-polygon {
  position: relative !important;
  left: 0px !important;
  top: 0px !important;
  border:1px solid black;
  background:#fff;
}

.init-displayNone {
  display:none;
}
</style>